php / mysql pagination
Posted
by arrgggg
on Stack Overflow
See other posts from Stack Overflow
or by arrgggg
Published on 2010-04-26T19:50:55Z
Indexed on
2010/04/26
19:53 UTC
Read the original article
Hit count: 338
php
Hi, I have a table with 58 records in mysql database. I was able to connect to my database and retrive all records and made 5 pages with links to view each pages using php script.
webpage will look like this:
name number
john 1232343456
tony 9878768544
jack 3454562345
joe 1232343456
jane 2343454567
andy 2344560987
marcy 9873459876
sean 8374623534
mark 9898787675
nancy 8374650493
1 2 3 4 5
that's the first page of 58 records and those 5 numbers at bottom are links to each page that will display next 10 records. I got all that. but what I want to do is display the links in this way:
1-10 11-20 21-30 31-40 41-50 51-58
note: since i have 58 records, last link will display upto 58, instead of 60.
Since I used the loop to create this link, depending on how many records i have, the link will change according to the number of records in my table. How can i do this?
Thanks.
© Stack Overflow or respective owner