Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 22nd, 2005, 1:18 PM   #1
bigguy
Professional Programmer
 
bigguy's Avatar
 
Join Date: Sep 2005
Location: Arkansas
Posts: 298
Rep Power: 0 bigguy is an unknown quantity at this point
Send a message via AIM to bigguy Send a message via MSN to bigguy Send a message via Yahoo to bigguy
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
email
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.
bigguy is offline   Reply With Quote
Old Nov 22nd, 2005, 1:40 PM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
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.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Nov 22nd, 2005, 1:59 PM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Nov 22nd, 2005, 2:02 PM   #4
Lich
Professional Programmer
 
Lich's Avatar
 
Join Date: May 2005
Location: Detroit
Posts: 254
Rep Power: 4 Lich is on a distinguished road
Send a message via AIM to Lich Send a message via MSN to Lich
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.
__________________
--John Cruz
Web Developer
www.cruzweb.net
Lich is offline   Reply With Quote
Old Nov 22nd, 2005, 9:31 PM   #5
bigguy
Professional Programmer
 
bigguy's Avatar
 
Join Date: Sep 2005
Location: Arkansas
Posts: 298
Rep Power: 0 bigguy is an unknown quantity at this point
Send a message via AIM to bigguy Send a message via MSN to bigguy Send a message via Yahoo to bigguy
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.
bigguy is offline   Reply With Quote
Old Nov 22nd, 2005, 11:14 PM   #6
Lich
Professional Programmer
 
Lich's Avatar
 
Join Date: May 2005
Location: Detroit
Posts: 254
Rep Power: 4 Lich is on a distinguished road
Send a message via AIM to Lich Send a message via MSN to Lich
Quote:
Originally Posted by bigguy
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 .
no. Do not confuse phpmyadmin with MySQL, they are not the same thing. MySQL is the database. PHPmyAdmin is a program, written in PHP, to allow mySQL database administration.

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
__________________
--John Cruz
Web Developer
www.cruzweb.net
Lich is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:43 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC