I have a table with 37 posts and now I want to select every 10 post per page
Is there any approach to limit items between interval numbers?
SELECT name FROM posts LIMIT(10-20)
What your referring to is pagination I believe.
LIMIT 10 will return 10 records, when using a second argument, LIMIT 0,10 for example, will return 10 records, starting at row 0. The first argument will become your variable depending on what page you are on. For page two, you would use LIMIT 10,10, page three LIMIT 20, 10.
"starting at row 0" isn't quite right
it's actually an offset, which i prefer to describe as "the number of rows to skip over"
so LIMIT 20,10 doesn't start at row 20, it skips over 20 rows
This topic is now closed. New replies are no longer allowed.