|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33787 no "out of sync"-error when preparing a statement
Submitted: 2005-07-20 15:55 UTC Modified: 2005-07-28 01:00 UTC
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: ladoo at gmx dot at Assigned:
Status: No Feedback Package: MySQLi related
PHP Version: 5.0.4 OS: Linux (x86)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ladoo at gmx dot at
New email:
PHP Version: OS:


 [2005-07-20 15:55 UTC] ladoo at gmx dot at
When the result of a statement isn't freed PHP gives an error when trying to issue a new query. It doesn't so when the new query is preparing a statement (see reproduce code). Then mysqli::errno and mysqli::error are empty.

use $stmt to decide wheter $stmt = $mysqli->prepare(...) worked not $mysqli->errno.

Reproduce code:
$my = new mysqli("localhost","user","password","db");
$stmta = $my->prepare("SELECT * FROM cms_Site");
$stmtb = $my->prepare("SELECT * FROM cms_Site");
if ($stmtb) {
	echo "prepare succeeded";
} else {
	echo "prepare failed<br />";
	echo "errno: ", $my->errno, "  - error: ", $my->error, "<br />";
$x = $my->query("") or die("errno: ".$my->errno."  - error: ".$my->error."<br />");

Expected result:
prepare failed
errno: 2014 - error: Commands out of sync; you can't run this command now
errno: 2014 - error: Commands out of sync; you can't run this command now

Actual result:
prepare failed
errno: 0 - error:
errno: 2014 - error: Commands out of sync; you can't run this command now


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-20 16:08 UTC]
Please try using this CVS snapshot:
For Windows:

 [2005-07-28 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-02-27 19:41 UTC] chedi dot toueiti at gmail dot com

it worked for me (but i'm using stored proc), hope it help you
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 23 20:01:31 2024 UTC