php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #55823 mysqli::query with MYSQLI_STORE_RESULT returns TRUE on an INSERT statement
Submitted: 2011-09-30 16:50 UTC Modified: 2013-03-22 07:39 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: esaour at gmail dot com Assigned: philip (profile)
Status: Closed Package: MySQLi related
PHP Version: Irrelevant OS: linux
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: esaour at gmail dot com
New email:
PHP Version: OS:

 

 [2011-09-30 16:50 UTC] esaour at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/mysqli.query
---
$results = $mysqli->query($sql_insert, MYSQLI_STORE_RESULT);
$results is TRUE


But,
$success =    $mysqli->real_query($sql_insert);
$results = $mysqli->store_result();
$results is FALSE

This is in direct contradiction with the docs of mysqli::QUERY
"Functionally, using this function is identical to calling mysqli_real_query() followed either by mysqli_use_result() or mysqli_store_result()."

Test script:
---------------
$mysqli = new mysqli('localhost', 'test', 'test123', 'test');

$sql_insert = "INSERT test values (null,'aa')";  //test table has an autoincrement ID column and a varchar(10) column

$success =    $mysqli->real_query($sql_insert);
$results = $mysqli->store_result();

var_dump($results);  // boolean false                                        

$results = $mysqli->query($sql_insert, MYSQLI_STORE_RESULT);

var_dump($results); // boolean true
$mysqli->close();

Expected result:
----------------
expecting $mysqli->query($sql_insert, MYSQLI_STORE_RESULT) to return FALSE

Actual result:
--------------
$mysqli->query($sql_insert, MYSQLI_STORE_RESULT); returns TRUE

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-10-18 21:12 UTC] andrey@php.net
-Assigned To: +Assigned To: philip
 [2013-03-22 07:38 UTC] philip@php.net
Automatic comment from SVN on behalf of philip
Revision: http://svn.php.net/viewvc/?view=revision&revision=329870
Log: Documented PHP Bug #55823 -- _query() and _real_query() are different
 [2013-03-22 07:39 UTC] philip@php.net
-Status: Assigned +Status: Closed
 [2013-03-22 07:39 UTC] philip@php.net
Thank you for the bug report, this has been fixed in SVN. Also, sorry for taking 
so long to respond. :]
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC