From: Peter Brawley Date: March 11 2006 5:53pm Subject: Re: mysql_commect or die List-Archive: http://lists.mysql.com/mysql/195673 Message-Id: <44130E89.9060203@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit fbsd_user wrote: > mysql_connect("localhost","root") > or die("Unable to connect to MySQL server"); > > $err mysql_connect("localhost","root"); > if ($err != 0) { > > Under what conditions will the die clause be taken. > > What is in $err if there is a error? > > Are these 2 statements basically doing the same thing? > mysql_connect() returns a PHP connection resource on success, FALSE on failure; or ... executes if the func returns FALSE. To see what the error is, try ... or exit( mysql_error() ). Best practice is to build your own generic error handler around this functionality. PB > > > > -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.375 / Virus Database: 268.2.1/279 - Release Date: 3/10/2006