how to generate pages dynamically

Discussion in 'PHP' started by rafiqasad, Jan 2, 2007.

  1. #1
    i have a comments page on my site where comments posted by the users are displayed. I want to know that is it possible that as the comments are increasing the pages created automatically. Mean if there are 10 comment then that are displayed on a page. If there are 20 comments then first 10 are displayed on one page and ohter on the next page and so on as this is the pure example of FORUMS please guide me
     
    rafiqasad, Jan 2, 2007 IP
  2. streety

    streety Peon

    Messages:
    321
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    How are you storing your comments? If it is in a database you can just use LIMIT to select the first 10 comments on the first page and then the next 10 on the next page.
     
    streety, Jan 3, 2007 IP
  3. KC TAN

    KC TAN Well-Known Member

    Messages:
    4,792
    Likes Received:
    353
    Best Answers:
    0
    Trophy Points:
    155
    #3
    Check out offset and limit in sql if you are storing the data in db as stated by streety.
     
    KC TAN, Jan 3, 2007 IP
  4. audax

    audax Peon

    Messages:
    83
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Search Google for PHP Pagination. There are some great tutorials on how to limit MySQL results - that is, if your comments are stored in a MySQL DB.

    Try this for starters:
    http://www.phpfreaks.com/tutorials/43/0.php
     
    audax, Jan 3, 2007 IP