Re: Using two colomns of mysql data as key/value pairs in arrays

From: Date: Mon, 20 Oct 2003 15:15:45 +0000
Subject: Re: Using two colomns of mysql data as key/value pairs in arrays
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-31182@lists.php.net to get a copy of this message
Chris, et al -- ..and then Chris Boget said... % .. % > 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 .. % % foreach(); list(); each(); % None are good ideas when iterating through an array generated by *_array(). Ahhh... The light begins to dawn. I only ever use while ( $row = fetch ) to go through my rows and then directly handle the fields I pull out, but I can see that one might loop across $row and for that you need only the indices that matter. [Actually, maybe I'm just too new at this, but I can't think of a practical example for which I would loop over $row... Care to help me out?] % And I'd hazard to guess that one of the most significant uses of any query is % to iterate through it's result set. Well, I typically do loop over the result set but typically don't loop over the fields in each record, so I don't know that I can agree with the weight you put on that. But at least I see why I could care :-) % % Chris Thanks & HAND :-D -- David T-G * There is too much animal courage in (play) davidtg@justpickone.org * society and not sufficient moral courage. (work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health" http://justpickone.org/davidtg/ Shpx gur Pbzzhavpngvbaf Qrprapl Npg!

« previous php.db (#31182) next »