Results 1 to 3 of 3

Thread: (HELP) count continue on next page

  1. #1
    Join Date
    Mar 2007
    Posts
    54
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default (HELP) count continue on next page

    Hi

    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
    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)) {
    $i++;
    //this is where it all goes
    }
    Anyone with help thank you

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    You are looking for a record pagination script. Have a look at this page where you can find a script as well as an explanation

  3. #3
    Join Date
    Jun 2006
    Location
    Acton Ontario Canada.
    Posts
    677
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Instead of just echoing out $i, you do this:
    echo $i+$offset;
    - Ryan "Boxxertrumps" Trumpa
    Come back once it validates: HTML, CSS, JS.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •