note 40583 added to function.mysql-errno
| From: | stry_cat at yahoo dot com | Date: | Mon, 08 Mar 2004 20:22:38 +0000 |
| Subject: | note 40583 added to function.mysql-errno | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66455@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.mysql-errno.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40583
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40583&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40583&report=yes
Search -- http://master.php.net/manage/user-notes.php