Hi .ben,

> Just out of interest, what's the standard/best/tried
> &tested method for handling errors in relation to 
> connecting to DB's?  i.e. how to check that the 
> connection was a success, and if not then display why.

Something like...

$dbh = mysql_connect ("foo", "bar", "baz") 
  or die (mysql_error ());

has always worked well for me. When it comes to queries I generally tack the
SQL on the end of the error, like this:

$q = mysql_query ($sql, $dbh) 
  or die (mysql_error (). "<br><b>". $sql. "</b>");

Obviously it's a good idea to turn this error reporting off on a production
site, otherwise you risk exposing details of your database structure.

HTH
Jon

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to