RE: How do you step through a database?
| From: | Jason Gan | Date: | Tue, 14 Aug 2001 04:53:19 +0000 |
| Subject: | RE: How do you step through a database? | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-8828@lists.php.net to get a copy of this message | ||
If you're using PHPLIB, then using database abstraction the code would look
like:
while ($db->next_record()) {
print $db->f("title");
}
-----Original Message-----
From: CJD [mailto:CJD@atmosphere_dot_co_dot_nz_.php.net]
Sent: Tuesday, 14 August 2001 7:56 AM
To: php-windows@lists.php.net
Subject: Re: How do you step through a database?
while ($item=mysql_fetch_array($result)) {
print $item[title];
}
The loop will continue until the result reaches the end then stops. Also
works for $result with no results in it (skips the loop) and you can use
mysql_data_seek($result,0);
to reset the counter to the top ready for the next loop
"Jeff Howard" <jeff.howard@berry-hinckley.com> wrote in message
news:20010813194146.57831.qmail@pb1.pair.com...
> I've used Visual Basic for years and have never had a problem with this
> issue. I can use the following code to do this:
>
> do until (rs.eof)
> ..
> rs.movenext
> loop
>
> Does anybody know how to step through a database in PHP?
>
>
>
>