note 40583 deleted from function.mysql-errno by nlopess
| From: | nlopess@php.net | Date: | Tue, 09 Mar 2004 14:53:25 +0000 |
| Subject: | note 40583 deleted from function.mysql-errno by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66493@lists.php.net to get a copy of this message | ||
Note Submitter: stry_cat@yahoo.com
----
A useful function for debugging:
function mysql_die() {
# debug function
global $SQL;
die("DATABASE ERROR -- " . mysql_errno() . " -- " . mysql_error() . " --
SQL: <B>$SQL</B>");
}
// Use this function here:
... your code with usual db connections ...
$result = mysql_query($SQL) or mysql_die();
... do something with the result
//This way of the query doesn't work you stop the script and know what mysql was having a
problem with.