php.net |  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
Votes:5
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
 [2004-06-21 00:44 UTC] adamsbarker at hotmail dot com
Description:
------------
"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]);
           }
           mysqli_free_result($result);
       }
       /* print divider */
       if (mysqli_more_results($link)) {
           printf("-----------------\n");
       }
   } 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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-17 16:12 UTC] georg@php.net
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] georg@php.net
If the server responds with "unkown command", you should 
upgrade your server to 4.1 (.3-beta). 
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC