PrintLogo

How to Capture Errors With PHP MySQL Queries




To capture the error of a PHP query against a MySQL database, use this syntax:

$result=mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}





This article comes from NetAdminTools:
http://www.netadmintools.com/

The URL for this story is:
http://www.netadmintools.com/art467.html

Copyright 1997-2008 NetAdminTools.com. Read our Terms of Use.