Hello all,
I am trying to integrate the mysql with php. As I am using the Red Hat
7.0, I know that they come pre-installed and pre-configured. When i
created test.php with the <?php phpinfo() ?> line, the page shows that
the php is able to recognize the presense of mysql. I created a small
table 'namelist' in a database named 'newone'. I am trying to read the
table through a php file. Here is the simple php page that i have
created for this purpose.
<html>
<head>
<title>Name List</title>
</head>
<body>
<?php
$db=mysql_connect ("localhost","myname","mypassword");
mysql_select_db ("newone",$db);
$result = mysql_query ("select * from namelist");
printf ("First Name: %s<br>\n", mysql_result($result,
0, "firstname"));
printf ("Last Name: %s<br>\n", mysql_result($result,
0, "lastname"));
?>
</body>
</html>
It is producing the following bunch of errors.
Warning: MySQL Connection Failed: Can't connect to local MySQL server
through socket '/var/lib/mysql/mysql.sock' (111) in
/var/www/html/namelist.php on line 7
Warning: Supplied argument is not a valid MySQL-Link resource in
/var/www/html/namelist.php on line 8
Warning: MySQL Connection Failed: Can't connect to local MySQL server
through socket '/var/lib/mysql/mysql.sock' (111) in
/var/www/html/namelist.php on line 9
Warning: MySQL: A link to the server could not be established in
/var/www/html/namelist.php on line 9
Warning: Supplied argument is not a valid MySQL result resource in
/var/www/html/namelist.php on line 10
First Name:
Warning: Supplied argument is not a valid MySQL result resource in
/var/www/html/namelist.php on line 11
Last Name:
Can any one tell me what causing it to generate these errors.
TIA
Chakravarthy Sannedhi
http://www.dpo.uab.edu/~kalyan
__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php