|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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) "" }
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 05:00:01 2025 UTC |
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" }