$query = "SELECT * FROM mytable LIMIT $i, 20";

Where 20 is the number of rows to retrieve and $i is the starting row.

By incrementing $i + 20 you can do next, prev buttons, or parse the total
number of rows into page links (prev - 1, 2, 3, 4, 5, 6.. 10.. 20 - next).

Search www.mysql.com for more information about using LIMIT in your queries.


----- Original Message -----
From: "Jason Soza" <[EMAIL PROTECTED]>
Sent: Thursday, May 16, 2002 12:31 PM
Subject: [PHP] Making Multiple Pages

> I have some ideas on how this should be done, but I'm at work and can't
> really test them, so I was thinking maybe I could run it by you all and
> maybe get some feedback and/or new ideas.
> I have a PHP/MySQL-generated page that displays image thumbnails.
> Currently, I have a loop that makes a table and table rows, fills the
> rows with the thumbnails, then when there's no more information, it
> completes whatever row it's on with blank <td>'s, then closes the table.
> This was working fine, but my site is actually attracting more traffic
> than I originally thought, and I'm getting more image submissions. It's
> getting to where it's no longer practical to arrange all the thumbnails
> onto one page, I need to have like 25 on one page, then have the script
> create a link at the bottom so users can click and see the next 25.
> I'm thinking I need to use some kind of row count language in the
> script, i.e. first count how many rows are in the MySQL table, if it's
> less than 25, just display them all. If there's more than 25, display
> only 1 - 25, then create a link to view 26 - 50, etc.
> Is that what I need to be looking into? Any other ideas would be
> appreciated. Thanks!
> Jason Soza
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

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

Reply via email to