Re: Using List() and a do-while loop with MySQL results.
| From: | Chris | Date: | Sat, 22 Jan 2005 00:37:51 +0000 |
| Subject: | Re: Using List() and a do-while loop with MySQL results. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-207019@lists.php.net to get a copy of this message | ||
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