
Cupidvogel
Members-
Posts
45 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
Cupidvogel's Achievements

Member (2/5)
0
Reputation
-
Thanks. Can you migrate this question to Application Design, or should I ask this question there again?
-
I am stuck just at the beginning. That is, say, I have the database designed, and the client side prepared. Now I have to design the PHP. So how do I do it? And what did you mean by This is pretty much "dynamic web pages 101"?
-
I have noticed that in Stackoverflow, there are basically 4-6 kinds of different URLs. One is for questions, like DOUBLE vs DECIMAL in MySQL. One is for user profile page, like http://stackoverflow.com/users/1469954/cupidvogel. One is for new question, like http://stackoverflow.com/questions/ask, etc. With each page request, the server sends a page as required. Now how do I achieve this on the server side? Should there be one catchall PHP script, which will parse the URL to note what type of page is the client asking (for example, if it parses the URL and finds out that the client is asking for a topic page, it will perhaps extract the question id/text from the URL, query the DB to fetch relevant data, construct the HTTML and send it) and send it accordingly, or should there be separate scripts for each page type? And for either, how do I configure PHP/Apache for this? If I have a page like foo.php, I can see it through http://localhost/foo.php. But if I want it to capture http://localhost/foo.php as well as http://localhost/foo.php/ask/questions, etc, what do I have to do?
-
So part from the caching bit, this is just like the canonical method of the URI module in Perl which normalizes URLs, resolving unnecessary up and down traversals within the address to give it in a compact form?
-
Thanks. Please do it and explain what is happening. I am too new to PHP to do these tests myself!
-
Hi, can anybody explain what is meant by realpath in PHP? In particular, I was studying the documentation for the clearstatecache function in the PHP manuals, it has an optional first boolean parameter named $clear_realpath_cache, which determines whether or not to clear the realpath cache for the file mentioned as the 2nd parameter. So what difference will the absence of the first parameter make?
-
Thanks.
-
Wow! So now tell me, is there any situation at all where I should be using $mysql->query($query) instead of the prepared statement? That is, for any data coming from the client side, whether data they have inputted, or data the page itself had hardcoded (for example, attribute of some element), should I always use prepared statement?
-
So if I use a particular query, like Select * from foo where boo='bar', and I need to use it more than once in the same script, using prepared statements will increase the speed/efficiency?
-
Hi, we need prepare statements in MySQL to dynamically query or update databases, for it has no exec or eval type of statement that will execute the statement as if it were code, right? However, why do we need a whole slew of prepare related functions in PHP-MySQLi as well? Surely all the variables we intend to bind, we can easily include them in a normal query string where they will auto expand, and then we pass the statement to MySQLi, from where we will get the same result?
-
Right. Thanks.
-
Thanks. That looks simple enough, dunno why didn't it occur to me.
-
Hi, surely we all have seen in Facebook questions like Which of the following IMDB top 250 movies have you seen?, followed by a list of check-options with a button, which on clicking fetches all the members who have voted for that option (if there are two many number of such users, as for this particular question, where each option may be voted by more than a million users, the user-list is retrieved only partly and continues do so on subsequent requests from the client). Question is, how can the list of users be stored in the database? If the survey poll has an id of say, 123, the it is fair to assume that there will be a table like username_123, where there will be a column containing the option value, then one containing the option text. How to insert the list of users? One way may be by storing the user names in a string, delimited by space, and on requests, send the string to PHP, where PHP uses regular expression to split the string and extract the usernames. However the process looks very clumsy, and very painstaking, given the fact that the column value will have to be frequently updated as more voter vote, or some of the existing voters unvote (either by withdrawing their vote altogether, or voting another item in case of radio-buttons). Any idea, anyone?
-
Please explain solutions 2 and 3 in detail, I am kind of new to PHP! When should I call session_write_close? What is meant by session data? I mean, once the user is logged in, how can a script log out of it during a polling request while the user still continues to browse other pages and expect the pages to be personalized? How come MySQL and memcache help here?
-
Hi, I was reading an article on long-polling at http://www.nolithius.com/game-development/comet-long-polling-with-php-and-jquery where I found the following lines (scroll down a little in that page to view this, under the PHP sleeps across the entire session heading): I didn't quite understand what it means. Suppose I have a webpage foo.php, and it contains two updateable parts, one calls coo.php to update asynchronously, while the other calls goo.php. Now both coo.php and goo.php themselves poll the database, returns the result set if they get any, or wait for, say, 15 seconds before polling the database again, and this continues, until the total execution time exceeds 100 seconds, upon which PHP results the empty (or populated) result-set. The Javascript on the client side receives that empty or populated data and immediately sends another request. Now aren't these two requests to 2 different scripts (albeit from the same script) independent of each other, or is it that when coo.php sleeps, foo.php and goo.php is forced to sleep as well?