Jump to content

Displaying last result from a mysql table with a limit of 10 results per page


convinceme

Recommended Posts

I am not quite sure its more related to maths or php anyway

Problem:

I want to show the last post in a mysql table. And i am displaying them with a limit of 10, i.e. 10 results per page. Now i have a problem figuring it out what would be the starting point of the results display in this case. I know it sounds confusing so let me give a few examples to illustrate my point.

 

Example 1:

Last Id = 15.

So now we want to display with a limit starting from 10

 

Example 2:

And if the last id = 22

we want to display with a limit starting from 20 because remember we want to show 10 results on each page.

 

The problem is to figure out which was the last '10' starting point, which in example 1 would be 10 and in example 2 be 20.

ok ahmm no its not about pagination... i know how to do that its just that how to figure out the nearest 10.

 

using LIMIT would paginate it.. but the starting point is the problem.. if the last id is 24 how to make sure the limit starts from 20 thats my point... i want it to be dynamic if that makes any sense

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.