Jump to content

Pagination needed


umraz

Recommended Posts

Pagination occurs based on the amount of rows pulled out from the DB. First you must get that count, then you must run math based on that count for how many results you want per page. So if your query there pulls 20 records and you only want 5 per page, then your static max per page would be 5.. So then you want to count the total rows pulled by your query. So you can do that math. 5 / 20 = 4 so that means you should have 4 pages :)

 

Pagination isn't a quick one liner or even a few liner..

 

As such, your current query doesnt support the concept. As you need to limit your results you need to select where to get your results from (starting at which row, in accordance with that limit). You need to also compensate for what if you get 21 records, and only need to pull one record for that 6th page.

 

On another note, its better to come here and ask for help on what your stuck with. Not with what you want us to do for you instead. You will get more answers here if you simply give an actual problem rather than say I need this, please help.. something like that makes most of us think you dont want help achieving the desired goal, you just want one person to come along, do it.. and you just copy and paste it, then away you go :)

 

Not tryin to be mean, just informative..

Link to comment
https://forums.phpfreaks.com/topic/229246-pagination-needed/#findComment-1181232
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.