View Full Version : (HELP) count continue on next page

04-19-2007, 08:08 AM

I wanted know how can I make the numbers count to continue when clicked on page 2, page 3 and so on..
Lets say I am showing top ten users with 10 users per page and it starts out
1. User1
2. User2
3. User3
// and so on
and then you click on page 2 and it should continue counting from 10 so that page two shows
11. User11
12. user12
// and so on with any more pages I might have.
BUT instead my code starts out the count from 1 on any next page you click.

here is my code

$entries_per_page = "10";

if(isset($_GET['page'])) {
$page = $_GET['page'];
} else {
$page = 1;
$total_pages = ceil($count / $entries_per_page);
$offset = ($page - 1) * $entries_per_page;

$ssi = mysql_query("SELECT blahh blahh DESC LIMIT $offset, $entries_per_page");
$ i = 0;

while ($row = mysql_fetch_assoc($ssi)) {
//this is where it all goes

Anyone with help thank you

04-19-2007, 08:49 AM
You are looking for a record pagination script. Have a look at this page (http://phpsense.com/php/php-pagination-script.html)where you can find a script as well as an explanation

04-19-2007, 12:58 PM
Instead of just echoing out $i, you do this:
echo $i+$offset;