[Help] How to put Rank on pagination

Discussion in 'PHP' started by llipop88, Apr 16, 2008.

  1. #1
    Hi All,

    I am new to php, just wanna study as part of the course. I would like to add rank on each row data query from database.
    I try some method, but it did't work right. My way was when click on second page. The Rank start over from number 1-8, by right it should start from number 8 to 16. and page number 3 start from 17 to 25. I try to modify the code from Jatinder. But it seem like too difficult for me.
    below are the code. please advice

    The code shown below
    this is page.php
    this is ps_pagination.php from Jatinder
    Please help..urgent..dateline for project submission are near :(
     
    llipop88, Apr 16, 2008 IP
  2. bartolay13

    bartolay13 Active Member

    Messages:
    735
    Likes Received:
    14
    Best Answers:
    1
    Trophy Points:
    98
    #2
    to give rank in paginating you must use limit

    make your query as dynamic as possible

    $query = "select * from table where sample = '". $sample ."' limit 0,8";

    make the limit dynamic. for example in this query
    limit 0 is page 1 meaning your record set start from 1,

    then when the user turns to page to, change the limit 0 dynamically, lets say

    limit 8,8;

    the right parameter of limit determines the count of records to output.
     
    bartolay13, Apr 16, 2008 IP
  3. llipop88

    llipop88 Guest

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank for your reply..
    but can you giv a sample coding.. i m affair I cannot catch up due to my limited php knowledge..
     
    llipop88, Apr 17, 2008 IP