Log in

View Full Version : X results per page



Mob1us
01-02-2007, 04:58 AM
Okay, I was wondering how you might go about getting a loop to stop at a certain number of entries. For example, I'm building forums and I want it to stop pulling entries at 25 posts per page. Furthermore, I don't want to say something like
//The following query is part of a "while" loop
mysql_query("SELECT * FROM $database WHERE $posts")
//$posts= "id < 26" on page one
//$posts= "id > 25 AND id < 51" on page 2
//ETC. because posts if a post is deleted within that range then it will only show 24 posts. Would I use the "Continue" feature? If so, how would I manipulate that?

thetestingsite
01-02-2007, 05:26 AM
You could try



mysql_query("SELECT * FROM $database Limit 0,25");


That will start at the first row of entries and stop after 25 rows.

Hope this helps.