php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46829 mysqli_multi_query() affects next query
Submitted: 2008-12-11 02:26 UTC Modified: 2009-01-13 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dayseye at 21cn dot com Assigned:
Status: No Feedback Package: MySQLi related
PHP Version: 5.2.8 OS: WinXP
Private report: No CVE-ID: None
 [2008-12-11 02:26 UTC] dayseye at 21cn dot com
Description:
------------
first, execute mysqli_multi_query() with some INSERT some rows in a 
table;
then ,execute mysqli_query() to insert a row into ANOHTER;

execute mysqli_insert_id($link) get the newly inserted id, will 
return the first inserted id that from the firts 
mysqli_multi_query(). and the mysqli_query() is failed to insert 
data.

Reproduce code:
---------------
mysqli_multi_query($link, "INSERT INTO `a` VALUES (NULL, 'Y'); INSERT INTO `a` VALUES (NULL, 'Y')");   //should return new id 31, 32

mysqli_query($link, "INSERT INTO `b` VALUES (NULL, 11, 'hello')"); //should return new id 12;

echo mysqli_insert_id($link);


Expected result:
----------------
12

Actual result:
--------------
31

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-05 12:13 UTC] jani@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2009-01-13 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".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC