This is my query:
$result = mysql_query("SELECT * FROM Posts WHERE MATCH (City) AGAINST ('$city') ORDER by Date DESC LIMIT 10");
Basically I want t开发者_运维技巧o skip the first 10 results and only select result N: $page * 10
to show the results that correspond to that page. How can I do this?
Check the keyword OFFSET :
... LIMIT 10 OFFSET 10
You're looking for the OFFSET keyword
$offset = $page*10;
$result = mysql_query("SELECT * FROM Posts WHERE MATCH (City) AGAINST ('$city') ORDER by Date DESC LIMIT 10 OFFSET '$offset'");
Use
Limit 10,10
Where the first 10 is the offset and the second 10 is how many rows you want to retrieve after the offset
精彩评论