![]() |
<a href...> question
The code below is from a simple social networking application that I'm studying (not interested in making a social network app, but the code is interesting to follow).
The table USERS has the following fields: id (IDs are assigned in order of registration.) username PASSWORD firstname lastname dob gender location html CODE valid lastlogin Two questions: 1. Is it a good idea to use the same variable ($new) in each line below (although I'm sure that PHP doesn't care)? 2. I don't understand the last line (echo "Our...) at all. (Let's say that the last user to register is "Snicker.") PHP Code:
Dave |
php Code:
It's very simple, the variable $new becomes the username from the SQL Query :) And as far as using the same variable for each line, it will make no difference, but it is bad practice, as any data in the variable will be overwritten, especially in this case for pulling SQL Results |
Thanks.
I take it that, when PHP is directed to a location, e.g., http://localhost/myfolder/mysubfolder, it will automatically try to open an index.php file within "mysubfolder." Is this correct? Dave |
Not always, the default file that is loaded is called the "DirectoryIndex". Your server (I'm guessing Apache) will use what are called .htaccess files.
When apache receives the request for a page it looks for the closest .htaccess file (often they can be cached in RAM) and uses those guidelines to display the correct page and headers. If you want to change what default page is loaded just put this in a file called ".htaccess" in the directory you want to change. Note: You will not be able to just rename a file to ".htaccess" on Windows, Open->File->Save As. Code:
DirectoryIndex index.php |
| All times are GMT. The time now is 10:12 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0