#41543 [Opn->Bgs]: Mysql_result doesnt report error code
| From: | tony2001@php.net | Date: | Wed, 30 May 2007 16:06:26 +0000 |
| Subject: | #41543 [Opn->Bgs]: Mysql_result doesnt report error code | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-113208@lists.php.net to get a copy of this message | ||
ID: 41543
Updated by: tony2001@php.net
Reported By: benjicharlton at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: MySQL related
Operating System: WAMP (winxp)
PHP Version: 5.2.2
New Comment:
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions. Due to the volume
of reports we can not explain in detail here why your report is not
a bug. The support channels will be able to provide an explanation
for you.
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2007-05-30 15:56:08] benjicharlton at gmail dot com
err I mean "or Die(mysql_errno()) when refering to my normal or Die
commands.
------------------------------------------------------------------------
[2007-05-30 15:54:44] benjicharlton at gmail dot com
Description:
------------
in this example the table called has no entries. Therefore
mysql_result ($title,0) should produce an error....which it does however
it appears ERROR_NO = 0 and no message is associated.
Obviously my work around was to create my own error trap but my normal
"OR DIE" is "or DIE(mysql_errno)
which doesn't really help anyone debug code failure.
Reproduce code:
---------------
mysql_select_db($database_db_connect, $db_connect);
$query_title ="SELECT MAX(TitleID) FROM title";
$title = mysql_query($query_title, $db_connect) or die(mysql_error());
$id_title = mysql_result($title,0);
if (!$id_title){echo "error:";die("<b>A fatal MySQL error
occured</b>.\n<br />Query: " . $title . "<br />\nError: (" .
mysql_errno() . ") " . mysql_error());}
Expected result:
----------------
A fatal MySQL error occured.
Query: Resource id #6
Error(#num) Result set contained no rows.
Actual result:
--------------
A fatal MySQL error occured.
Query: Resource id #6
Error(0)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41543&edit=1