php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32433 problem with multi_query
Submitted: 2005-03-23 19:23 UTC Modified: 2005-03-23 23:47 UTC
From: alexzhen at hotmail dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.0.3 OS: WinXP (Professional) with SP2
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: alexzhen at hotmail dot com
New email:
PHP Version: OS:

 

 [2005-03-23 19:23 UTC] alexzhen at hotmail dot com
Description:
------------
using php5.0.3 and mysql 4.1.9

i think i've similar bug with <a href="http://bugs.php.net/bug.php?id=31668">http://bugs.php.net/bug.php?id=31668</a>

anyway, if you remove line 8 and 9. it work perfectly fine.
or you can add these following codes between the line 8 and 9.

$mysqli=new mysqli("localhost", "root", "xxx", "xxx");
$mysqli->query("");
$mysqli->close();

thanks

Reproduce code:
---------------
1:		$mysqli = new mysqli("localhost", "root", "xxxxxxxxxxxxxx", "xxxxxxxxx");
2:		if ($mysqli->multi_query("select 1 as Total")) {		
3:			if (!$result = $mysqli->store_result()) die("first section query error");
4:			echo "Total: ".$result->fetch_object()->Total; //should output Total: 1.
5:			echo "<br><br>";
6:			$result->free();
7:		}else echo $mysqli->error;
8:		$mysqli->close();
9:		$mysqli = new mysqli("localhost", "root", "xxxxxxxxxxxxx", "xxxxxxxxxxxxx");
10:	if ($mysqli->multi_query("select 1 as Total;select 2 as Needle")) {
11:		if (!$result = $mysqli->store_result()) die("second section query error");
12:		echo "Total: ".$result->fetch_object()->Total;
13:		$result->free();
14:		echo "<br><br>";
15:		$mysqli->next_result();
16:		if (!$result = $mysqli->store_result()) die("second section query error");
17:		echo "Needle: ".$result->fetch_object()->Needle;
18:		$result->free();
19:	}else echo $mysqli->error;	
20:	$mysqli->close();

Expected result:
----------------
Total: 1

Total: 1


Needle: 2

Actual result:
--------------
Total: 1

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ';select 2 as Needle' at line 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-23 23:47 UTC] sniper@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC