On single page, I am displaying 20 records at a time and with that records, I am generating PDF with their profile to export / download for admin.
Now, what i want is, for ex. on 4th Page i am passing, 4 while actual records i will have will be 61 ~ 80.. and on..
for example:
3rd page: 41 ~ 60 records
4th page: 61 ~ 80 records
5th page: 81 ~ 100 records and so on..
Does Any one have idea, How can i pass dynamic Start and End query limit in this case?
Simple (don't consider following as valid PHP
code! Because.... it's not):
$page = $_GET['page'] ? $_GET['page'] : 1;
$records_on_page = X;
$offset = $records_on_page * ($page-1);
$limit = "LIMIT $offset,$records_on_page"
page, offset, on_page
1, 00, 20
2, 20, 20
3, 40, 20
4, 60, 20
5, 80, 20
etc.
all logic.