#44897 [Fbk->Opn]: failed to prepare statement
| From: | top dot bagger at bk dot ru | Date: | Tue, 27 May 2008 07:02:11 +0000 |
| Subject: | #44897 [Fbk->Opn]: failed to prepare statement | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-125290@lists.php.net to get a copy of this message | ||
ID: 44897
User updated by: top dot bagger at bk dot ru
Reported By: top dot bagger at bk dot ru
-Status: Feedback
+Status: Open
Bug Type: MySQLi related
Operating System: CentOS 5
PHP Version: 5.2.6
New Comment:
Mysql function that I wrote returns only one result. But anyway I will
try and provide you feedback.
Previous Comments:
------------------------------------------------------------------------
[2008-05-27 00:14:32] jani@php.net
Maybe if you fetch all the results caused by the execute of the CALL
statement before you try executing another query?
e.g. while($stmta->fetch());
------------------------------------------------------------------------
[2008-05-02 20:29:31] top dot bagger at bk dot ru
Sorry, I forgot to add my output of this:
State of user: 1prepare failed
errno: 2013 - error: Lost connection to MySQL server during query
------------------------------------------------------------------------
[2008-05-02 20:27:03] top dot bagger at bk dot ru
Description:
------------
"prepare" method call returns false if mysql stored procedure was
prepared before
Reproduce code:
---------------
$my = new mysqli("localhost","test","test","test_db");
$stmta = $my->prepare("CALL sp_auth_user(?,?)");
$user = 'user';
$pass = 'pass';
$stmta->bind_param("ss", $user,$pass);
$stmta->execute();
$stmta->bind_result($state);
$stmta->fetch();
printf("State of user: %s\n", $state);
$stmta->close();
$stmtb = $my->prepare("SELECT userId FROM appUsers WHERE login = ?");
if ($stmtb) echo "prepare succeeded";
else {
echo "prepare failed<br />";
echo "errno: ", $my->errno, " - error: ", $my->error, "<br
/>";
}
Expected result:
----------------
$stmtb contains mysqli_stmt object
Actual result:
--------------
$stmtb is false
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44897&edit=1