Re: Using two colomns of mysql data as key/value pairs in arrays
| From: | Chris Boget | Date: | Mon, 20 Oct 2003 14:26:22 +0000 |
| Subject: | Re: Using two colomns of mysql data as key/value pairs in arrays | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-31171@lists.php.net to get a copy of this message | ||
> result set. Chris, you've made a believer out of me; I'll start using
> mysql_fetch_assoc() for these kinds of queries from now on.
:p
> And in the spirit of only retrieving what you need from the database, I
> would agree that mysql_fetch_assoc() is the "better" option. However, other
> than maybe making my script run a little more slowly, I fail to see how
> mysql_fetch_array() is a bad thing. From what I can see, all it does is give
> me an additional numerically indexed reference to the data in my result set
> and if I choose to ignore it, then that's my choice. If it causes a
> significant slowdown in the performance of my script, then it's certainly a
> candidate for optimization.
> Am I missing something else?
foreach(); list(); each();
None are good ideas when iterating through an array generated by *_array().
And I'd hazard to guess that one of the most significant uses of any query is
to iterate through it's result set.
Chris