show content PAGE by PAGE - how ?

Discussion in 'PHP' started by dracula51, Jun 1, 2009.

  1. #1
    Hi.
    plz first hav a look here : http://www.w3schools.com/PHP/php_mysql_select.asp

    i can do such things.

    but when my database have more than 100 rows...it'll show 100+ row in a page.

    so im thinking to add PAGE system. maybe 10 item per page. i mean LIMIT will be 10

    i want it, to create autometically, pages....1,2,3,4,5......10...

    so first page will show first 10 rows. when i click page 2...it'll load & shows next 10 rows (11-20)

    can anyone plz help me to create such PAGE thing...plz
     
    dracula51, Jun 1, 2009 IP
  2. Fr0Gs

    Fr0Gs Peon

    Messages:
    42
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    there are alot of examples on google just search for php mysql pagination
     
    Fr0Gs, Jun 1, 2009 IP
  3. Kaizoku

    Kaizoku Well-Known Member

    Messages:
    1,261
    Likes Received:
    20
    Best Answers:
    1
    Trophy Points:
    105
    #3
    You are on the right track to use LIMIT sql, You can parse the page number in $_GET['page']
    http://www.domain.com/index.php?page=3

    Then you would in the sql
    $page = $_GET['page'] * 10;
    mysq_query("... LIMIT {$page},10");

    You will need to extend from that.
     
    Kaizoku, Jun 1, 2009 IP