From:             benjicharlton at gmail dot com
Operating system: WAMP (winxp)
PHP version:      5.2.2
PHP Bug Type:     MySQL related
Bug description:  Mysql_result doesnt report error code

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 bug report at http://bugs.php.net/?id=41543&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41543&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41543&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41543&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41543&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41543&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41543&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41543&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41543&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41543&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41543&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41543&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41543&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41543&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41543&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41543&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41543&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41543&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41543&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41543&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41543&r=mysqlcfg

Reply via email to