Chakravarthy K Sannedhi wrote:

>       $db=mysql_connect ("localhost","myname","mypassword");
>       mysql_select_db ("newone",$db);
>       $result = mysql_query ("select * from namelist");

[snip]

> 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

You could not connect (in case you did not figure that out) and:

> Warning: Supplied argument is not a valid MySQL-Link resource in
> /var/www/html/namelist.php on line 8

etc. are from the fact you do not have a valid $db.
$db = mysql_connect( ... );
if( $db ){
   ...
}

First, I would check the user/password with 'mysql', e.g.:
mysql newone myname mypassword

If that works, then it is  a mystery to me as to why it is failing but you may
want to connect using network sockets e.g. by specififying the host:
$db = mysql_connect( 'the.host.name', 'myname', 'mypassword );

<shameless_plug>
Also, you may want to check out class.DBI which abstracts the database like
the perl module by the same name: http://evilbill.org/php/DBI.php3
</shameless_plug>

--Bill



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

Reply via email to