Re: The return of mysql_fetch_assoc()
| From: | Ray Hunter | Date: | Wed, 30 Jul 2003 05:38:20 +0000 |
| Subject: | Re: The return of mysql_fetch_assoc() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157486@lists.php.net to get a copy of this message | ||
> $fooVar = mysql_fetch_assoc($result)["barColumn"];
No bug here...mysql_fetch_assoc($result) is a function that takes a
result set as an argument and returns only one row as an associated
array...that is why you need to do
> $record = mysql_fetch_assoc($result);
> $fooVar = $record["barColumn"];
That is logic when it comes from the database...database results are
returned as rows with various column(s).
This allows you to go through each row and pull out all the columns for
that row.
HTH,
BigDog