Re: Using List() and a do-while loop with MySQL results.
| From: | Jason Wong | Date: | Sat, 22 Jan 2005 00:16:01 +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-207014@lists.php.net to get a copy of this message | ||
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