#42399 [NEW]: myqli_query causes error after calling mysql procedures
| From: | mfeldheim at gmail dot com | Date: | Thu, 23 Aug 2007 14:51:29 +0000 |
| Subject: | #42399 [NEW]: myqli_query causes error after calling mysql procedures | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-116557@lists.php.net to get a copy of this message | ||
From: mfeldheim at gmail dot com
Operating system: Linux Debian
PHP version: 5.2.3
PHP Bug Type: MySQLi related
Bug description: myqli_query causes error after calling mysql procedures
Description:
------------
After calling a mysql stored procedure with mysqli_query I get the error
"Commands out of sync; you can't run this command now" with the following
mysqli_query execution.
That is independent from mysqli_query resultmode parameter or a postquery
$result->close();
In my case the mysql procedure returns a resultset - didnt test for the
case of no resultset
Reproduce code:
---------------
$mysqli = new mysqli($host, $user, $password, $database);
$result = $mysqli->query('CALL mysql_stored_procedure(abc)');
if( $mysqli->errno ) die( $mysqli->error );
while( $data = $result->fetch_object() ):
print_r( $data );
endwhile;
$result->close();
$result = $mysqli->query('SELECT column1, column2 FROM table WHERE id =
1');
if( $mysqli->errno ) die( $mysqli->error );
while( $data = $result->fetch_object() ):
print_r( $data );
endwhile;
$result->close();
$mysqli->close();
Expected result:
----------------
mysqli_result (
resultset for the first query
)
mysqli_result (
resultset for the second query
)
Actual result:
--------------
mysqli_result (
resultset for the first query
)
Commands out of sync; you can't run this command now
--
Edit bug report at http://bugs.php.net/?id=42399&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42399&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42399&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42399&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42399&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=42399&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42399&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42399&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42399&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42399&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42399&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=42399&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=42399&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42399&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42399&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42399&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42399&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42399&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42399&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42399&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42399&r=mysqlcfg