php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42399 myqli_query causes error after calling mysql procedures
Submitted: 2007-08-23 14:51 UTC Modified: 2007-08-23 14:58 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: mfeldheim at gmail dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.2.3 OS: Linux Debian
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mfeldheim at gmail dot com
New email:
PHP Version: OS:

 

 [2007-08-23 14:51 UTC] mfeldheim at gmail dot com
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



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-23 14:58 UTC] jani@php.net
See bug #32882 and bug #35203

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 19:01:30 2024 UTC