![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Professional Programmer
|
SQL/PHP Help
I need to know what this does?
case "login": $connection = mysql_connect($host, $user, $password) or die ("Could not connect."); $db = mysql_select_db($database, $connection) or die ("Could not select database."); I need to know what &host &user &password &database &connection does. Does it mean like connect to Database name host and then asign values in the user and password tables in the PHP i have a username password first name last name so i need to knwo what goes to what and thne when u loginin i have a login password field
__________________
Forgiveness is the fragrance that the violet sheds on the heal that has crushed it. - Mark Twain Destruction leads to a very rough road, but it also breeds creation. |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
First of all, those are dollar signs ($), not ampersands (&). They're very different. This is very basic PHP - I suggest you pick up a book on the language or take a look at the excellent documentation on www.php.net.
|
|
|
|
|
|
#3 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
If you bring up that link Ooble provided, and put things like this:
mysql_connect mysql_select_db in the search box and click "go", you should feel that Christmas has come early.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#4 |
|
Professional Programmer
|
aside from the fact that there's errors in your code and you should have it in PHP tags for this board, i'll try to explain your problem.
mysql_connect(); is a php function, it connects to mysql. It takes 3 args, host, user, and password. $host is the host where the database is. This is usually localhost $user is your database username and $password is your database password Now that you've connected to mysql, you need to select the database using mysql_select_db(); This takes the connection you made before ($connection) and the name of the database you're using, stored in the $database variable. Usually, all these variables are set in something like a config file that you make that all your site can access. The stuff like the login form doesn't do anything with this page, those variables are stored in $_POST[] you need to do something with them and check to see if it matches the name and password in the database. |
|
|
|
|
|
#5 |
|
Professional Programmer
|
Ok, localhost? what would that be I host with Yahoo, and it sasy PhpMyAdmin2.4.3.1 is running on myadmin.teamaando.com as bigguy@localhost.
Is this what i need or sumthign else, i have no idea how ot use phpmyadmin .
__________________
Forgiveness is the fragrance that the violet sheds on the heal that has crushed it. - Mark Twain Destruction leads to a very rough road, but it also breeds creation. |
|
|
|
|
|
#6 | |
|
Professional Programmer
|
Quote:
It says right there: bigguy@localhost. username@host. Localhost is your host, bigguy is your username, and you should know your password. I highly reccomend picking up something like SQL in a nutshell or PHP and mySQL web development and start reading or you'll be fumbling through this quite a bit. Read first, ask questions later |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|