I'm trying to create a simple pagination for my website.
I have a table's rows with 3 value
id (AI)
name
price
SELECT * FROM `mytable` ORDER BY `id`LIMIT 10
I use very simple MySQL request to show it, and JS/AJAX button to show more.
When it ordered by ID, it's easy to show more - I know the last ID, and I'm adding this info to the next request
SELECT * FROM `mytable` WHERE `id` > $lastid ORDER BY `id` LIMIT 10
But HOW can I create same pagination, if I'll order it by price?
It can be 100 items with same price, so I can't write
WHERE `price` > $lastprice
because it will show only 10% of all items with same price
Also, I can't write
WHERE `price` > $lastprice AND `id` > $lastid
because item with biggest id can be with less price.
Any ideas to make it work?
Thanks!
p.s. Actually it's not a real pagination, it's only one button "SHOW MORE" that takes next 10 items from server by AJAX.