MySQL LIMIT 20 after X.id

I'm not sure how to ask about this, so it's hard for me to find answers online ... here's something like what I want:

SELECT id FROM table ORDER date DESC LIMIT 20, 30 [start after X id]

      

... so the point is that I am creating a paging system ... the only problem is if someone clicks on page 2, in theory a new entry could be made to return the order so the person can see the last record the first page as the first record on the second page if a new record has been made since the moment you clicked on page 2.

I want to be able to still limit, but say my limit ... hey, give me the next 20 after this ID? thanks mysql lol.

But yes, sorry if this question is difficult to fulfill, because I said that it is difficult for him to put into words what I want, so it is difficult for me to find the answer.

+3


source to share


2 answers


Add a clause WHERE

to your SQL statement



SELECT id FROM table WHERE id > X ORDER date DESC LIMIT 20, 30

      

+5


source


I think what I'm going to end up with is grabbing the time the user starts to browse the list and then uses Craigs' solution based on that time .... then if they update the results, I'll update the time when they start browsing.



0


source







All Articles