|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-10-11 15:02 UTC] navin@php.net
Description:
------------
new mysqli_result($mysql); doesn't return expected instance
Reproduce code:
---------------
$mysql = new mysqli('localhost', 'root', '', 'test');
$mysql->query('SELECT * FROM `test`');
$result = new mysqli_result($mysql);
$row = $result->fetch_row();
$result->close();
$mysql->close();
var_dump($row);
Expected result:
----------------
array
Actual result:
--------------
NULL
+ Warning messages:
Warning: Couldn't fetch mysqli_result in test.php on line 4
Warning: Couldn't fetch mysqli_result in test.php on line 6
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 18:00:01 2025 UTC |
This works: $mysql = new mysqli('localhost', 'root', '', 'test'); $mysql->query("SELECT 'test'"); $result = new mysqli_result($mysql); $row = $result->fetch_row(); And this doesn't: $mysql = new mysqli('localhost', 'root', '', 'test'); $result = $mysql->query("SELECT 'test'"); $row = $result->fetch_row();Oups, a mistake in my previous comment. I ment: This works: $mysql = new mysqli('localhost', 'root', '', 'test'); $result = $mysql->query("SELECT 'test'"); $row = $result->fetch_row(); And this doesn't: $mysql = new mysqli('localhost', 'root', '', 'test'); $mysql->query("SELECT 'test'"); $result = new mysqli_result($mysql); $row = $result->fetch_row(); --------------- $mysql->real_query('...'); is not relevant to this problem.Tested the latest 5.0.6-dev from snaps.php.net $mysql = new mysqli($host, $user, $passwd); $mysql->real_query("SELECT 'foo' FROM DUAL"); $myresult = new mysqli_result($mysql); $row = $myresult->fetch_row(); $myresult->close(); $mysql->close(); And it fails the test. (Couldn't fetch mysqli_result...)