Although this is not a php list... mysql_connect() returns TRUE on success and FALSE on failuer, so testing $link like "if($link)" means it did connect.
your script should read: $link=mysql_connect("localhost") // the !(bang as it is called) means NOT // so !TRUE == FALSE if(!$link) { printf("Could not connect to mysql server: %s",mysql_error()); } else { //connection is good } or, better yet: if(!$link=mysql_connect("localhost")) { printf("Could not connect:\n%s : %s\n",mysql_errno(),mysql_error()); } else { //connection is good } hope it helps. --------------------- Johnny Withers [EMAIL PROTECTED] p. 601.853.0211 c. 601.209.4985 -----Original Message----- From: anandakkumar araskumar [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 29, 2001 6:37 AM To: [EMAIL PROTECTED] Subject: please help me Hi all Iam new to php and iam learning that from scratch.I came across a problem in connecting mysql from php script.I run php in windows2000 under IIS configured to personal web server.I have installed mysql with server and client and both are running in the same machine(ofcourse, i can you use the ipaddress of localhost).I didn't set any username or password with mysql. This is my php script: $link=mysql_connect("localhost"); if($link) die("Couldn't connect to mysql".mysql_error() ); print "Successfully connected to server"; when i execute this program iam getting the following message: Couldn't connect to mysql Anyone please help me as this is very urgent. thanks in advance Regards shahjahan __________________________________________________ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 --------------------------------------------------------------------- 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 --------------------------------------------------------------------- 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