#31771 [Com]: mysql_fetch_array incomplete output

From: Date: Wed, 02 Feb 2005 06:56:44 +0000
Subject: #31771 [Com]: mysql_fetch_array incomplete output
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-73237@lists.php.net to get a copy of this message
ID: 31771 Comment by: mrangryfish at hotmail dot com Reported By: kstamenov at rocketmail dot com Status: Open Bug Type: MySQL related Operating System: RHEL Linux PHP Version: 5.0.3 New Comment: I have this same problem, with Eventum code. I am attempting to use Eventum 1.4 with PHP 5.0.3 and mysql 4.1.8 and the sql statements that use mysql_fetch_array($sql, MYSQL_ASSOC) are returning bad results eg ( [#B] => 2 [@] => AskIT ) They should be returning something like ( [prj_id] => 2 [prj_title] => Tech Team ) using mysql_fetch_assoc makes no difference. I have had no problem running PHP 4 with the mysql 4.1.8 database backend so I assume it is something wrong with the php 5.0.3 mysql libraries with returning these associative indexed arrays? I have even tried using the latest pear packages but it makes no difference. Previous Comments: ------------------------------------------------------------------------ [2005-01-31 00:58:12] kstamenov at rocketmail dot com Description: ------------ This is related to bug #31600 which was marked bogus but I was able to recreate the issue and isolate the event. I am not familiar with the mysql interface inner workings so that might be a MySQL bug. The problem: $query_str = "SELECT * FROM table"; will display incorrect result while "SELECT field1,field2 FROM table" works as expected. The issue is the same as the bug described in #31600 The problem occurs when MySQL 4.1 database is accessed from php4 script then php is upgraded to php5(compiled with 4.1 libraries) and the script tries to access the same database even with a different username with correct password. It is solved when the database server is restarted. The problem though persists if the database is accessed from two different servers running php4 and php5(compiled with 4.1 mysql lib) if the php4 is first to access the database after restart the php5 one will display the incorrect output and vice versa. Reproduce code: --------------- $query_str = "SELECT * FROM table"; $result = mysql_query("$query_str"); var_dump(mysql_fetch_assoc); Expected result: ---------------- field1 ="value"; field2 = "value" field3 = "value" field4 = "value" Actual result: -------------- "B"="value; "" = value; missing missing ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31771&edit=1

« previous php.bugs (#73237) next »