|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: jacob at aub dot dk
New email:
PHP Version: OS:


 [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: Thu Apr 18 15:01:28 2024 UTC