#19116 [Opn->Fbk]: mysql_fetch_array wont get associative values
| From: | georg@php.net | Date: | Tue, 27 Aug 2002 05:26:01 +0000 |
| Subject: | #19116 [Opn->Fbk]: mysql_fetch_array wont get associative values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-17906@lists.php.net to get a copy of this message | ||
ID: 19116
Updated by: georg@php.net
Reported By: bzink@crewercs.com
-Status: Open
+Status: Feedback
Bug Type: MySQL related
Operating System: Linux and XP
PHP Version: 4.2.1
New Comment:
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php
Thank you for your interest in PHP.
Please remember, that the mysql_fetch_array is case sensitive. To see
the contents of $row use var_dump($row).
Previous Comments:
------------------------------------------------------------------------
[2002-08-26 22:17:55] bzink@crewercs.com
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 this bug report at http://bugs.php.net/?id=19116&edit=1