-
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 :"(
-
Obviously. It's cause you started the counter at 0 :p
Try replacing this:
with this:
PHP Code:
$wheretostart = (integer) $_GET['page'];
$wheretostart = $wheretostart*5;
$w = isset($_GET['page']) ? $wheretostart : 0;
-
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.
-
Oops. Multiplied instead of plus.
PHP Code:
$wheretostart = (integer) $_GET['page'];
$wheretostart = $wheretostart+5;
$w = isset($_GET['page']) ? $wheretostart : 0;
-
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.
-
Do some random math operations. Aim at this line:
PHP Code:
$wheretostart = $wheretostart+5;
while I think of something.
-
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
-
PHP Code:
$wheretostart = (integer) $_GET['page'];
$wheretostart = $wheretostart*5;
$w = isset($_GET['page']) ? $wheretostart : 0;
if ($wheretostart==1) { $w=0; }
-
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. :(
-
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"