|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28860 multiple statements don't work with mysqli_multi_query
Submitted: 2004-06-21 00:44 UTC Modified: 2004-07-19 06:38 UTC
Avg. Score:4.4 ± 1.2
Reproduced:4 of 5 (80.0%)
Same Version:1 (25.0%)
Same OS:2 (50.0%)
From: adamsbarker at hotmail dot com Assigned:
Status: Not a bug Package: MySQL related
PHP Version: 5CVS-2004-06-21 (dev) OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: adamsbarker at hotmail dot com
New email:
PHP Version: OS:


 [2004-06-21 00:44 UTC] adamsbarker at hotmail dot com
"mysqli_multi_query" works fine when only using 1 statement, however when using more than 1 statement the function returns empty.

Reproduce code:
$query  = "SELECT * FROM database_name.first_table;";
$query .= "SELECT * FROM database_name.second_table";

/* execute multi query */
if (mysqli_multi_query($link, $query)) {
   do {
       /* store first result set */
       if ($result = mysqli_store_result($link)) {
           while ($row = mysqli_fetch_row($result)) {
               printf("%s\n", $row[0]);
       /* print divider */
       if (mysqli_more_results($link)) {
   } while (mysqli_next_result($link));

Expected result:
Works perfect when this line is taken out:

 $query .= "SELECT * FROM database_name.second_table";

But doesn't work when this line is kept in.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-17 16:12 UTC]
if mysqli_multi_query fails, you should check your error 
with mysqli_error instead of filing a bug report. 
 [2004-07-18 01:49 UTC] adamsbarker at hotmail dot com
I have checked "mysqli_error" and it comes up with "Unknown command".

The thing I don't get is that each statement on its own works perfectly in "mysqli_multi_query", however, if trying to add any more than 1 statement, it does nothing.
 [2004-07-19 06:38 UTC]
If the server responds with "unkown command", you should 
upgrade your server to 4.1 (.3-beta). 
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Mar 24 20:03:41 2023 UTC