Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: 1,2,3,4,5 etc next page 6,7,8,9,10 and so on

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

    Default

    I did bro. I have everything working as I said. The pagination works fine. The only thing that I want to see added to my pagination is the ability to have the numbers countinue from where it left off previuos page, just like I said in my example.

    Page 1 shows the below:
    1. John
    2. Micdhela
    3. HHhjaja
    4. Jajkhakj
    5. Uhajma

    The page 2 shows the below:
    1. Laila
    2. JjkKjka
    3. Blah Blah
    4. Bljaa
    5. IIloa whatever

    Now if you see the numbers in BOLD you will notice how on page 2 it starts back from 1 instead of starting from 6, thats what I want toi include in my pagination, so that the count starts from where it left off on previous page. It shouldn't be this hard to get what I am saying :"(

  2. #12
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Obviously. It's cause you started the counter at 0
    Try replacing this:
    PHP Code:
    $w 0
    with this:
    PHP Code:
    $wheretostart = (integer) $_GET['page'];
    $wheretostart $wheretostart*5;
    $w = isset($_GET['page']) ? $wheretostart 0
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

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

    Default

    Hi Thanks you for the code.
    BUT it starts the count from 11 on page 2 instead of 6. And when I click back on page 1 it starts the count from 6 instead of 1. I think there is just a lil bit more to be added to your code I am waiting

    Thanks buddy.

  4. #14
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Oops. Multiplied instead of plus.
    PHP Code:
    $wheretostart = (integer) $_GET['page'];
    $wheretostart $wheretostart+5;
    $w = isset($_GET['page']) ? $wheretostart 0
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

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

    Default

    lol sorry but it still is not working properly.
    You see it starts fine but when you click on page 2 it starts from 8 and then page 3 it starts from 9. And then when you click on page 1 again it starts from 7.

  6. #16
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Do some random math operations. Aim at this line:
    PHP Code:
    $wheretostart $wheretostart+5
    while I think of something.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

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

    Default

    What I found out is that putting a Multiply * instead of plus + makes it work better.

    When I tried putting a + it just messes up the count totally, it starts count at 7 for first page, 8 for second page and 9 for third page.
    BUT
    When I put * it starts the count from 11 on page 2 instead of 6, it seems like its starting the count from 5 instead of 1, and thats the only thing that needs to fixed, somehow for the count to start from 1
    Last edited by shyne; 08-08-2007 at 06:36 PM.

  8. #18
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    PHP Code:
    $wheretostart = (integer) $_GET['page'];
    $wheretostart $wheretostart*5;
    $w = isset($_GET['page']) ? $wheretostart 0;
    if (
    $wheretostart==1) { $w=0; } 
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

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

    Default

    NO LICK again here.

    Its the same thing. It starts from 11 on page 2 and when clicked back to page 1 it starts from 6.

  10. #20
    Join Date
    Aug 2005
    Posts
    971
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok, here's the simple algorithm:

    Code:
    get the page number from the URL(e.g ?pg=2)
    multiply that number by the number of results you want(if ten, then, 10*2 = 20) which will be your starting point
    in your select add something like "SELECT * FROM yourtable LIMIT startindex-1, number of results"

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
  •