Excerpt from http://www.php.net/list
"*Note: * *list()* only works on numerical arrays and assumes the numerical indices start at 0."
So the best way , in my opinion, to achieve this effect would be:
while(list($id, $someinfo) = mysql_fetch_row($result)) { // Some stuff }
Chris
Phillip S. Baker wrote:
Greetings all,
I am pulling records from a MySQL DB. I am walking through the array using the whole. if ( $row = mysql_fetch_assoc($result)) { do { // Some stuff } while ( $row = mysql_fetch_assoc($result)); }
What I am wondering is if there is something I can do like.
if ( list ($id, $someinfo) = mysql_fetch_assoc($result)) { do { // Some stuff } while ( list ($id, $someinfo) = mysql_fetch_assoc($result)); }
When I tried something like that The variables where not populated. Is there something I am doing wrong, or is this just something that cannot be done (or is bad programming practice??)
Thanks.
-- Blessed Be
Phillip
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php