PHP 4.0 Bug #8656: mysql_fetch_object duplicate return values

From: Date: Thu, 11 Jan 2001 16:39:15 +0000
Subject: PHP 4.0 Bug #8656: mysql_fetch_object duplicate return values
Groups: php.dev 
Request: Send a blank email to php-dev+get-43787@lists.php.net to get a copy of this message
From: sigma@headquarters.ca Operating system: Linux RedHat 6.2 kernal 2.2.18 PHP version: 4.0.3pl1 PHP Bug Type: MySQL related Bug description: mysql_fetch_object duplicate return values configure line: quick install script: for ($i = 0; ($row = mysql_fetch_object($results)) != false; $i++) { foreach ($row as $key => $value) { $orders[$i][$key] = $value; } } foreach($orders as $value) { foreach($value as $key => $here) { echo "key = $key, value = ".$value[$key]."\n"; } } will produce key = 0, value = first value key = database_column, value = first value key = 1, value = second value key = database_column, value = second value ... description: This is basically reproducing the column in a numbered and named row in the returned array. This is against the documentation that states that we can only access the values by the column name because numbers are illegal property names. It seems to me that the default is MYSQL_BOTH but that by the documentation that isn't true. By the documentation it seems to me that the default is MYSQL_ASSOC. I posted a note to the page to always use MYSQL_ASSOC/NUM as the result_type. -- Edit Bug report at: http://bugs.php.net/?id=8656&edit=1

« previous php.dev (#43787) next »