PDA

View Full Version : mysql_connect (Connecting to MySQL)


tkone
01-26-2000, 06:42 AM
Just spent a few hours banging my head up against the wall trying to save form data to mysql.[nbsp][nbsp]With the PHP3 script:

<html>
<body>
<?php

mysql_connect (localhost, username, password);

mysql_select_db (dbname);

mysql_query (&quot;INSERT INTO tablename (first_name, last_name)
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]VALUES ('$first_name', '$last_name')
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp] &quot;);

After much trail and error found that the (localhost) should be (mysql01).[nbsp][nbsp]I found that this wasn't overly apparent (for morons like myself) in the documentation.[nbsp][nbsp]Hope this might help someone out.

PS Is this the proper way to connect?
Cheers

Terra
01-26-2000, 07:48 AM
1) Yes, this is the correct forum to post this into... :)
2) Yes, replacing 'localhost' with 'mysql01' will work, as will 'mysql01.FutureQuest.net'... :)

We wrote the MySQL Activation letters with referencing in mind...

The letter states that the MySQL server is located at:
mysql01.futurequest.net

It also provides command line usage:
mysql -uxacme -hmysql01.futurequest.net -p xacme

We have also included brief Perl/PHP examples so that you could cross reference with the PHP/Perl documentation...

We try to take a -median- approach to be heavy enough for the beginning MySQL users to take the first step, but light enough for the MySQL pro to get right to work...

I am not quite sure what we missed...[nbsp][nbsp]If you have any suggestions/input that can be made to the Activation Letter, please feel free to post them up, or send them privately to 'support@FutureQuest.net'...

I do agree that many 'tutorial' sites on the net assume 'localhost' to be the 'host'...[nbsp][nbsp]However, the FutureQuest DAS::MySQL servers are being built on the backend for speed, flexibility, and scalability...[nbsp][nbsp]MySQL01 is the first to go online and is now in full production capacity...

--
Terra
--Home of the Open Source Activation Letters--
FutureQuest

JE
01-30-2000, 03:05 AM
Hi..

Tk...you wouldn't happen to be the same tkone from TBOL would you?
------------------
------------------------------------------------------------------------------------------
and NOW...to get your FREE eMAIL at the best domain name in the world..simply click below, and you will be hooked up with:

<yourname@blazing-hot.com>

Get it NOW at: www.blazing-hot.com/mail/email.shtml (http://www.blazing-hot.com/mail/email.shtml)
------------------------------------------------------------------------------------------
[nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp][nbsp]BLAZING-HOT.COM™ 2000