php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30896 mysql(i)_fetch_*() fails on "SELECT * FROM t"
Submitted: 2004-11-25 11:05 UTC Modified: 2004-11-26 10:54 UTC
From: niklas dot lampen at publico dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.0.2 OS: Linux Debian
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.
Password:
Status:
Package:
Bug Type:
Summary:
From: niklas dot lampen at publico dot com
New email:
PHP Version: OS:

 

 [2004-11-25 11:05 UTC] niklas dot lampen at publico dot com
Description:
------------
Fetching rows fail on both mysql_() and mysqli_() when query is simple "SELECT *".

Not working:
"SELECT * FROM t ORDER BY f"

Working:
"SELECT * FROM t WHERE 1=1 ORDER BY f"
"SELECT * FROM t ORDER BY f LIMIT n"
"SELECT f, f2, f3, f4 FROM t ORDER BY f"

Reproduce code:
---------------
$Res = mysql_query("SELECT * FROM t ORDER BY f", $Conn);
$R = mysql_fetch_object($Res);
var_dump($R);

Expected result:
----------------
object(stdClass)#2 (4) { ["f"]=>  string(4) "data" ["f2"]=>  string(4) "data" ["f3"]=>  string(4) "data" ["f4"]=>  string(4) "data" }

Actual result:
--------------
object(stdClass)#2 (2) { ["@"]=>  string(8) "#CERT11#" [""]=>  string(0) "" }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-25 18:06 UTC] georg@php.net
Can't repeat. Could you test the following script please: 
 
<?php 
 
$mysql = new mysqli("localhost", "user", "password", 
"test"); 
 
printf("Client-Version: %s\n", $mysql->client_version); 
printf("Server-Version: %s\n", $mysql->server_version); 
 
$mysql->query("DROP TABLE IF EXISTS f"); 
$mysql->query("CREATE TABLE f (f char(4), f2 char(4), f3 
char(4), f4 char(4))"); 
 
$mysql->query("INSERT INTO f VALUES ('data', 'data', 
'data', 'data')"); 
 
$result = $mysql->query("SELECT * FROM f ORDER BY f"); 
 
$row = $result->fetch_object(); 
var_dump($row); 
?> 
 
Output: 
Client-Version: 40108 
Server-Version: 40108 
object(stdClass)#3 (4) { 
  ["f"]=> 
  string(4) "data" 
  ["f2"]=> 
  string(4) "data" 
  ["f3"]=> 
  string(4) "data" 
  ["f4"]=> 
  string(4) "data" 
} 
 [2004-11-26 09:18 UTC] niklas dot lampen at publico dot com
It seems to work just fine now. I can't reproduce the error anymore even with the very same code I found this "bug".
I have not updated php nor mysql nor anything else on the box.

Sorry for the mistaken bug report.
 [2004-11-26 10:54 UTC] tony2001@php.net
No bug -> bogus.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 13:01:30 2024 UTC