Re: Using List() and a do-while loop with MySQL results.

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

 



On Saturday 22 January 2005 08:11, Jason Wong wrote:
> On Saturday 22 January 2005 08:02, Phillip S. Baker wrote:
> > I am pulling records from a MySQL DB.
> > I am walking through the array using the whole.
>
> You do realise that doing this ...
>
> > if (  $row = mysql_fetch_assoc($result)) {
> >     do    {
> >         //    Some stuff
> >    }    while (  $row = mysql_fetch_assoc($result));
> > }
>
> ... effectively discards the first result of any resultset that you get?
> Unless that really is your intention then simply use a while-loop. If there
> aren't any results nothing in the while-loop will be executed (which means
> there is no need for the IF).

Sorry, no it doesn't. But it's much clumsier than simply using a while-loop.

> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> New Year Resolution: Ignore top posted posts

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux