#19116 [NEW]: mysql_fetch_array wont get associative values
| From: | bzink at crewercs dot com | Date: | Tue, 27 Aug 2002 02:17:56 +0000 |
| Subject: | #19116 [NEW]: mysql_fetch_array wont get associative values | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-17897@lists.php.net to get a copy of this message | ||
From: bzink@crewercs.com
Operating system: Linux and XP
PHP version: 4.2.1
PHP Bug Type: MySQL related
Bug description: mysql_fetch_array wont get associative values
Note: This fails in 4.2.1 and 4.2.2
mysql_connect($host, $user, $pass) or
die("could not connect");
mysql_select_db($database);
$result = mysql_query("SELECT * FROM $table");
while ($row = mysql_fetch_array($result)) {
printf ("Name: " . $row[1] . "--" . $row["first"] .
"--" . "<br>"
);
}
mysql_free_result($result);
Data is placed in the numeric indices, but NOT the associative ones. This
fails on dedicated web hosting (JTL net) as well as my on version running
on XP. $row[1] gets data, but $row["first"] does not. Also does not work
if add the MYSQL_ASSOC parameter nor does the mysql_fetch_assoc() work.
--
Edit bug report at http://bugs.php.net/?id=19116&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=19116&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=19116&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=19116&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=19116&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=19116&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=19116&r=support
Expected behavior: http://bugs.php.net/fix.php?id=19116&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=19116&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=19116&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=19116&r=globals