|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-05-30 15:56 UTC] benjicharlton at gmail dot com
[2007-05-30 16:06 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 12:00:02 2025 UTC |
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)