Re: Using List() and a do-while loop with MySQL results.
| From: | Phillip S. Baker | Date: | Sat, 22 Jan 2005 01:51:45 +0000 |
| Subject: | Re: Using List() and a do-while loop with MySQL results. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-207020@lists.php.net to get a copy of this message | ||
Thanks.
That was the problem. I switched it to FetchRow and got what I was looking
for.
--
Blessed Be
Phillip
"Chris" <listschris@leftbrained.org> wrote in message
news:41F1A05F.2090905@leftbrained.org...
> 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
> >
> >
> >