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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.