[NTLUG:Discuss] Looks like PHP + MYSQL is working but now I'm getting another problem (MYSQL)
Barker, Bob
bbarker at caprock.com
Fri May 19 16:48:46 CDT 2000
I'm not 100% here but I think you need to add the password field to your
connection string even if it's blank.... I don't know if you need double or
single quotes though.
$dbc = mysql_connect('localhost', 'root','');
Bob
-----Original Message-----
From: hector M Banda [mailto:hector at need-info.com]
Sent: Friday, May 19, 2000 4:37 PM
To: discuss at ntlug.org
Subject: [NTLUG:Discuss] Looks like PHP + MYSQL is working but now I'm
getting another problem (MYSQL)
Warning: MySQL Connection Failed: Can't connect to local MySQL server
through socket '/tmp/mysql.sock' (111) in /home/httpd/html/second.php3 on
line 4
Warning: 0 is not a MySQL link index in /home/httpd/html/second.php3 on line
5
Warning: 0 is not a MySQL link index in /home/httpd/html/second.php3 on line
6
Warning: 0 is not a MySQL result index in /home/httpd/html/second.php3 on
line 7
First Name:
Warning: 0 is not a MySQL result index in /home/httpd/html/second.php3 on
line 8
Last Name:
Warning: 0 is not a MySQL result index in /home/httpd/html/second.php3 on
line 9
Address:
Warning: 0 is not a MySQL result index in /home/httpd/html/second.php3 on
line 10
Position:
This is the actual code:
<html>
<body>
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
$result = mysql_query("SELECT * FROM employees",$db);
printf("First Name: %s<br>\n", mysql_result($result,0,"first"));
printf("Last Name: %s<br>\n", mysql_result($result,0,"last"));
printf("Address: %s<br>\n", mysql_result($result,0,"address"));
printf("Position: %s<br>\n", mysql_result($result,0,"position"));
?>
</body>
</html>
Thanks,
--
===========================================
Hector M Banda
Senior Computer Programmer
Information Systems Department
Imperial Valley College
Imperial Ca, 92251
Phone: 760.355.6105
Fax : 425.790.6379
============================================
_______________________________________________
http://ntlug.org/mailman/listinfo/discuss
More information about the Discuss
mailing list