Results 1 to 2 of 2

Thread: X results per page

  1. #1
    Join Date
    Aug 2006
    Location
    America
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default X results per page

    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
    Code:
    //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?

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    You could try

    Code:
    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.
    Last edited by thetestingsite; 01-04-2007 at 05:09 AM.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •