From: michael at kofler dot cc Operating system: win + linux PHP version: 5.0.3 PHP Bug Type: MySQLi related Bug description: mysqli_next_result does not return error code
Description: ------------ PHP's mysqli_next_result uses mysql_next_result of the C API the C function returns: 0 (OK, there are more results) -1 (OK, there are no more results) >0 (error code for the next result) see http://dev.mysql.com/doc/mysql/en/mysql-next-result.html however, the PHP function mysqli_next_result returns only TRUE (more results) or FALSE (error or no more results) as a consequence, when processing a multi query, it is impossible to detect whether an error happend in the 2nd, 3rd etc. SQL command Reproduce code: --------------- $cmd="SELECT 1;SELECT 2;SELECT bogus;SELECT 4"; $ok = $mysqli->multi_query($cmd); // $ok is TRUE if the 1st SQL command was OK // errors in further SQL commandos do not affect $ok // this is to be expected, C API behave the same way if($ok) { do { $result = $mysqli->store_result(); if($result) { ... show result ... $result->close(); } // at this point, I would like to detect // whether the next result has errors or not !!!! $next = $mysqli->next_result(); echo "<p>next=$next</p>\n"; } while($next); } Expected result: ---------------- I want to get this output [result 1 ...] next=1 [result 2 ...] next=n > 0 so I know an error happend with the 3rd result Actual result: -------------- [result 1 ...] next=1 [result 2 ...] next= (this gives me no idea whether all results have been processed all right or whether an error has happenend) -- Edit bug report at http://bugs.php.net/?id=32093&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32093&r=trysnapshot4 Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=32093&r=trysnapshot50 Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=32093&r=trysnapshot51 Fixed in CVS: http://bugs.php.net/fix.php?id=32093&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=32093&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=32093&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=32093&r=needscript Try newer version: http://bugs.php.net/fix.php?id=32093&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=32093&r=support Expected behavior: http://bugs.php.net/fix.php?id=32093&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=32093&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=32093&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=32093&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32093&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=32093&r=dst IIS Stability: http://bugs.php.net/fix.php?id=32093&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=32093&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=32093&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=32093&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=32093&r=mysqlcfg