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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ladoo at gmx dot at
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Mon Oct 14 19:01:28 2024 UTC