Trying to add offset to a mysqli query, but it won't return any rows:
Works:
SELECT * FROM posts WHERE published='1' ORDER BY id DESC
Does not work:
SELECT * FROM posts WHERE published='1' ORDER BY id DESC OFFSET 20
Trying to add offset to a mysqli query, but it won't return any rows:
Works:
SELECT * FROM posts WHERE published='1' ORDER BY id DESC
Does not work:
SELECT * FROM posts WHERE published='1' ORDER BY id DESC OFFSET 20
You can try this syntax instead as OFFSET needs LIMIT keyword:
SELECT * FROM posts WHERE published='1' ORDER BY id DESC LIMIT 40 OFFSET 20;
This means that it will return the limit of fetched rows 40 only and skipping the first 20 rows.
You can check this link https://www.w3schools.com/php/php_mysql_select_limit.asp that can help you.