Bug #61446 [Asn->Csd]: Can't prepare statement without getting a result
| From: | fjanisze@php.net | Date: | Thu, 13 Apr 2017 09:50:16 +0000 |
| Subject: | Bug #61446 [Asn->Csd]: Can't prepare statement without getting a result | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208514@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=61446&edit=1
ID: 61446
Updated by: fjanisze@php.net
Reported by: dasmag at gmail dot com
Summary: Can't prepare statement without getting a result
-Status: Assigned
+Status: Closed
Type: Bug
Package: MySQLi related
Operating System: ubuntu 11.04
PHP Version: 5.3.10
Assigned To: mysql
Block user comment: N
Private report: N
New Comment:
In the latest release the error message is copied to mysqli. The problem in the script is that
mysqli do not support buffered queries, before executing the second 'prepare' the user
shall extract the result OR call store_result().
Previous Comments:
------------------------------------------------------------------------
[2012-05-02 12:25:20] uw@php.net
Very good find! Thanks!
Andrey, mysqlnd sets an appropriate error message but we do not copy it into mysqli. mysqli has code
for libmysql but not for mysqlnd. Maybe the copy was not needed for mysqlnd in the past?
>mysqlnd_stmt::prepare
| info : stmt=0
| info : query=SELECT 2
| >mysqlnd_conn_data::simple_command
| | info : command=STMT_PREPARE ok_packet=13 silent=0
| | >mysqlnd_conn_data::get_state
| | <mysqlnd_conn_data::get_state
| | >_mysqlnd_pestrdup
| | | info : file=mysqlnd.c line= 326
| | | info : ptr=0x893d594
| | <_mysqlnd_pestrdup
| | info : adding error [Commands out of sync; you can't run this command now] to the list
| | >mysqlnd_conn_data::get_state
| | <mysqlnd_conn_data::get_state
| | error: Command out of sync. State=4
| <mysqlnd_conn_data::simple_command
| info : FAIL
<mysqlnd_stmt::prepare
>mysqlnd_stmt::dtor
------------------------------------------------------------------------
[2012-03-19 23:25:42] dasmag at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/mysqli.prepare
---
There are an error if I heven't got a result from statement.
Just execute the script with and without commented string.
And there are no description in the documentation.
Test script:
---------------
<?php
$mysqli = new mysqli("localhost");
$st = $mysqli->prepare("SELECT 1");
$st->execute();
// print_r($st->get_result()->fetch_assoc());
$st = $mysqli->prepare("SELECT 2");
$st->execute();
?>
Actual result:
--------------
Fatal error: Call to a member function execute() on a non-objec
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61446&edit=1