RE: Using two colomns of mysql data as key/value pairs i n arrays

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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.

Yeah, OK, I can see how having the extra numerically indexed data would make
life difficult in the result set returned by *_array(). As a matter of fact,
I now recall using mysql_fetch_assoc() a couple times specifically when I
needed to loop over the result set using foreach().

Thanks for your time.

> -----Original Message-----
> From: Chris Boget [mailto:chris@wild.net]
> Sent: Monday, October 20, 2003 10:26 AM
> To: Hutchins, Richard; php-db@lists.php.net
> Subject: Re:  Using two colomns of mysql data as 
> key/value pairs
> in arrays
> 
> 
> > 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
> 
> 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux