note 36481 deleted from function.mysql-error by tomsommer
| From: | tomsommer@php.net | Date: | Tue, 06 Jul 2004 09:29:13 +0000 |
| Subject: | note 36481 deleted from function.mysql-error by tomsommer | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-72738@lists.php.net to get a copy of this message | ||
Note Submitter: josh ><>
----
Use this function as a substitute for mysql_query() to automatically return the error number, error
description and the query if it fails. Note that this functions assumes you are working with the
last database opened.
function myquery ($query) {
mysql_query($query);
if (mysql_errno())
echo "MySQL error ".mysql_errno().": ".mysql_error()."\n<br>When
executing:<br>\n$query\n<br>";
}