#33787 [Opn->Fbk]: no "out of sync"-error when preparing a statement
| From: | tony2001@php.net | Date: | Wed, 20 Jul 2005 14:08:34 +0000 |
| Subject: | #33787 [Opn->Fbk]: no "out of sync"-error when preparing a statement | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-82216@lists.php.net to get a copy of this message | ||
ID: 33787
Updated by: tony2001@php.net
Reported By: ladoo at gmx dot at
-Status: Open
+Status: Feedback
Bug Type: MySQLi related
Operating System: Linux (x86)
PHP Version: 5.0.4
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[2005-07-20 15:55:54] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=33787&edit=1