#30349 [Csd->Bgs]: MySQL returning false result array when using large query
| From: | georg@php.net | Date: | Thu, 07 Oct 2004 05:09:18 +0000 |
| Subject: | #30349 [Csd->Bgs]: MySQL returning false result array when using large query | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-67225@lists.php.net to get a copy of this message | ||
ID: 30349
Updated by: georg@php.net
Reported By: cgroen at xs4all dot nl
-Status: Closed
+Status: Bogus
Bug Type: MySQL related
Operating System: Linux (Debian Sarge)
PHP Version: 5.0.2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Don't use numeric column aliases when you use mysql_fetch_assoc with
MYSQL_BOTH. These aliases will override numeric indexes (or vice versa)
in your array.
Previous Comments:
------------------------------------------------------------------------
[2004-10-07 05:40:59] cgroen at xs4all dot nl
Guess it's not a bug.. Started thinking about it and looked up the
mysql_fetch_array description..
The lower index numbers are the indexes the function adds
(mysql_fetch_array returns an array with both associative and numbered
keys)..
What still remains is the question why PHP versions prior to 5.0.2
didn't have a problem with this ? Somehow 5.0.2 implements the
mysql_fetch_array function different from it's predecessors..
------------------------------------------------------------------------
[2004-10-07 05:17:28] cgroen at xs4all dot nl
Description:
------------
Mysql version: 4.1.4-gamma-standard-log
PHP version: 5.0.2
PHP config: /configure --with-apxs=/usr/bin/apxs
--with-mysqli=/usr/bin/mysql_config
--with-oci8=/usr/local/oracle/product/8.1.7
--with-config-file-path=/etc
I have built a PHP program that automatically builds very complex
queries and parses them.. Up until version 5.0.1 of PHP, everything
worked fine but since I installed 5.0.2 everything falls apart..
When running a very big/complex query, somehow the result array gets
mangled.. It contains index numbers that where never in the query to
begin with (like in the query below, it returns indexes ranging from 1
till 565) and index numbers that should have values don't..
This is the case with both MySQL and MySQLi.. Like I said, everything
worked fine with PHP 5.0.1, it's just 5.0.2 that has this problem..
When running the query in MySQL client everything goes well and the
right values are assigned to the right columns..
Hope I made the problem clear..
Regards,
Carlos
Reproduce code:
---------------
http://www.gris.nl/code.html
Expected result:
----------------
An associative array with the column numbers specified in the query as
index keys for the appropriate values..
Actual result:
--------------
An array with non existing keys (in the query) and with keys that point
to the wrong column's result..
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30349&edit=1