Reputation: 3
How can you LIMIT SQL results and show them by order id
once you refresh the page? For en example:
Refresh #1;
Show Query with id 20
Rrefresh #2
Show query with id 21
Rrefresh #3
Show query with id 23
etc etc.
Upvotes: 0
Views: 150
Reputation: 59455
Did you mean - how to show latest N items ordered by id in descendant order?
select *
from table
order by id desc
limit 0, 10
(N = 10 in this case)
Upvotes: 0
Reputation: 21449
You can store the last showed id in a Session and than increment it on the next show.
to limit result you can use LIMIT:
SELECT * FROM `table` LIMIT 5
to order the result use ORDER BY:
SELECT * FROM `table` ORDER BY `id` ASC
Upvotes: 1