i’m working on a block which will display last 10 posts, when user clicks on “load more” button i would like to display 10 older posts.
how can i select last 10 rows if i’m already using DESC LIMIT?
mysql_query("SELECT title,id,alt_name FROM dle_post WHERE approve='1' AND date >= '$monthagodate'
AND date < '$curdate' + INTERVAL 1 day ORDER BY date DESC LIMIT $more;");
You are LIMITing using just one parameter. But you can use
LIMIT x,yto specify bothx(the position of the first record to return) andy(the number of records to return).Pass a variable to the page like
results.php?start=xto set a starting position.And then you can generate a link to the next page like so:
echo '<a href="results.php?start=' . ($_REQUEST['start']+10) . '">Next 10 results</a>';