#32433 [Opn->Bgs]: problem with multi_query
| From: | sniper@php.net | Date: | Wed, 23 Mar 2005 22:47:46 +0000 |
| Subject: | #32433 [Opn->Bgs]: problem with multi_query | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-75780@lists.php.net to get a copy of this message | ||
ID: 32433
Updated by: sniper@php.net
Reported By: alexzhen at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: MySQLi related
Operating System: WinXP (Professional) with SP2
PHP Version: 5.0.3
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2005-03-23 19:23:24] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=32433&edit=1