Help with agination

Discussion in 'PHP' started by newzone, Oct 15, 2012.

  1. #1
    I found this function for pagination but don't understand how to use it, http://www.strangerstudios.com/sandbox/pagination/diggstyle_function.txt
    What I have to modify?

    I'm executing the sql query like this

    $result = mysql_query("SELECT *
    FROM `sites`
    ORDER BY `sites`.`time_checked` DESC");
    PHP:
    To display some results
    while($row = mysql_fetch_array($result))
    		{
    	echo "Ip: ".$rowip." Last checked: " .$time_checked."<br>";
    }
    PHP:
    I want to add pagination, how can I return this function on page? how can I call it?
     
    newzone, Oct 15, 2012 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    You may want to look at jqGrid http://www.trirand.com/jqgridwiki/doku.php

    It takes some effort to learn how to use it (although there's plenty of sample code at the wiki and a good forum if you have trouble), but I think it's worth the effort. It's a really nice grid, and paging is inherent. You just set a couple of variables and it paginates. (I've used it for databases that would return a few million records, but jqGrid has them returning 25 records at a time, so everything runs fast, unless the user wants to page through every record.)
     
    Rukbat, Oct 15, 2012 IP