Re: Logic question
| From: | Julio Nobrega Trabalhando | Date: | Wed, 17 Apr 2002 15:58:14 +0000 |
| Subject: | Re: Logic question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-93342@lists.php.net to get a copy of this message | ||
Check out the LIMIT syntax from your database. If it's Mysql you can use
something like:
LIMIT nr, from
i.e: LIMIT 3, 30
Which will return 3 records starting from the 30th. So:
LIMIT 3, $starting
Just pass a different $starting (from,0, 3, 6, 9, 12, etc...) on each of
your pages.
--
Julio Nobrega.
Um dia eu chego lá:
http://sourceforge.net/projects/toca
Ajudei? Salvei? Que tal um presentinho?
http://www.submarino.com.br/wishlistclient.asp?wlid=664176742884
"Mike Fifield" <Mike.Fifield@schwab.com> wrote in message
news:FFE9B7BE532CD411872F00508BDFB8FE0EB76BA1@n6010vmx.nt.schwab.com...
> I am running the following SQL query which is returning a list of about
100
> entries. The entries are sorted numerically by image_id, but the numbers
in
> image_id are not sequential. For example a return might look like this.
> 97
> 54
> 53
> 43
> 32
> 31
> 21
>
> $query = "select * from galleries, images where galleries.gallery =
> '$gallery' and images.gallery_id = galleries.gallery_id and
images.image_id
> >= $offset - 3 and images.image_id < $offset order by images.image_id
desc";
>
>
> What I am trying to do is print out the first 3 rows on one page, and when
> the visitor hits next I want to be able to display the next 3, and so on.
> Does anyone have any ideas on how to do this?
>
> Mike Fifield
> Charles Schwab & Co, Inc.
> WARNING: All e-mail sent to or from this address will be received by the
> Charles Schwab corporate e-mail system and is subject to archival and
review
> by someone other than the recipient.
>
>