|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36658 mysqli_multi_query randomly fails
Submitted: 2006-03-08 21:30 UTC Modified: 2006-03-09 10:29 UTC
From: jacob at aub dot dk Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.1.2 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
20 + 42 = ?
Subscribe to this entry?

 [2006-03-08 21:30 UTC] jacob at aub dot dk
I'm seeing indeterministic behaviour from mysqli_multi_query(). In #35333 it is stated that one must process the result sets from mysql before executing another query. The following seem to somewhat disprove that, as it works sometimes. If processing of resultsets is a requirement then I believe the documentation should be updated to reflect this as it is not consistent behaviour in regard to regular query() calls, as I can perform multiple query() calls without processing anything.

Reproduce code:
$mysqli = new mysqli($hostname, $username, $password, $database);
$mysqli->multi_query("CREATE TABLE IF NOT EXISTS bar(id int); INSERT INTO bar(id) VALUES(1); ");
$result = $mysqli->query("SELECT COUNT(*) FROM bar");
if($result === FALSE) {
  print "ERROR: ".$mysqli->error."\n";
} else {
  $row = $result->fetch_assoc();
  print $row['COUNT(*)']."\n";

Expected result:
% php multiquerybug.php
% php multiquerybug.php
% php multiquerybug.php

Actual result:
% php multiquerybug.php
% php multiquerybug.php
ERROR: MySQL server has gone away
% php multiquerybug.php


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-09 10:29 UTC]
Can't reproduce (tested with MySQL 5.0.18 Server and client libs). 

As expected I'm always getting error "Packets out of order (Found: 2, expected 1)". This is correct behaviour, the server sends two errorcode packets.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Feb 23 15:01:34 2024 UTC