Re: mysql_connect() fails randomly

From: Date: Tue, 19 Aug 2003 02:11:53 +0000
Subject: Re: mysql_connect() fails randomly
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-159971@lists.php.net to get a copy of this message
* Thus wrote Jon Drukman (jsd@cluttered.com): > i've got a library file that i require() in all my scripts. it starts > with this line: > > $dbh=mysql_connect() or die("mysql connect failed: " . mysql_error()); The problem is the mysql_error() cant display what the problem is because the connect failed. (this needs to change in the docs.) Here is what you can do to get an error message of why it failed: . Ensure your error_reporting level is high enought to allow Warnings, and make sure display_errors is on. or . Turn on track_errors and use the variable $php_errmsg inplace of mysql_error(). die("mysql connecte failed: $php_errmsg"); HTH, Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#159971) next »