php.net |  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
Votes:3
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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
50 - 11 = ?
Subscribe to this entry?

 
 [2005-07-20 15:55 UTC] ladoo at gmx dot at
Description:
------------
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.

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

Reproduce code:
---------------
<?php
$my = new mysqli("localhost","user","password","db");
$stmta = $my->prepare("SELECT * FROM cms_Site");
$stmta->execute();
$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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-20 16:08 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [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
see http://www.rooftopsolutions.nl/article/173

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: Fri Apr 19 20:01:29 2024 UTC