[NTLUG:Discuss] Looks like PHP + MYSQL is working but now I'm getting another problem (MYSQL)

hector M Banda hector at need-info.com
Fri May 19 16:37:01 CDT 2000


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 
============================================





More information about the Discuss mailing list