mysql_fetch_array
| From: | Jay Greenspan | Date: | Sat, 22 Jul 2000 20:52:08 +0000 |
| Subject: | mysql_fetch_array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-7747@lists.php.net to get a copy of this message | ||
hey all,
So in a regular associative array you can walk through
the values with a list() = each
but after running a query and using mysql_fetch_array,
say...
$result = mysql_query("select 1 as fred, 2 as barney");
$row = mysql_fetch_array($result))
the array will have 4 elements. When you walk through them
with list()=each(), you'd get this:
key : 0, value = 1
key : fred, value = 1
key : 1, value = 2
key : barney, value = 2
It's easy enough to work around this, but I'm curious as to why
this assoicative array is a bit different than a normal associative array,
where you can get at the values by key or ordinal reference. Is there
a good reason for things working this way that I can't think of?
-j