php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34828 new mysqli_result($mysql); doesn't return expected instance
Submitted: 2005-10-11 15:02 UTC Modified: 2005-10-14 16:40 UTC
From: navin@php.net Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.0.5 OS: Windows XP Pro 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: navin@php.net
New email:
PHP Version: OS:

 

 [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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-11 15:07 UTC] derick@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip
 [2005-10-11 15:10 UTC] navin@php.net
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();
 [2005-10-11 15:12 UTC] derick@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip
 [2005-10-11 15:29 UTC] tony2001@php.net
Use $mysql->real_query() if you want to create mysqli_result instance yourself.
No bug here, that's how it works.
 [2005-10-11 15:54 UTC] navin@php.net
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.
 [2005-10-14 16:31 UTC] navin@php.net
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...)
 [2005-10-14 16:40 UTC] navin@php.net
With PHP-5.1.0RC1 works ok though.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Sep 15 14:01:28 2024 UTC