ID:               41543
 User updated by:  benjicharlton at gmail dot com
 Reported By:      benjicharlton at gmail dot com
 Status:           Open
 Bug Type:         MySQL related
 Operating System: WAMP (winxp)
 PHP Version:      5.2.2
 New Comment:

err I mean "or Die(mysql_errno()) when refering to my normal or Die
commands.


Previous Comments:
------------------------------------------------------------------------

[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

Reply via email to