Login   Register  
PHP Classes
elePHPant
Icontem

File: Usage.txt

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Britto Sebastian  >  Paginate  >  Usage.txt  >  Download  
File: Usage.txt
Role: Documentation
Content type: text/plain
Description: Usage of Pagination
Class: Paginate
Generate paginated navigation links
Author: By
Last change: some lines added
Date: 2005-12-29 03:42
Size: 688 bytes
 

Contents

Class file image Download
@author Britto Sebastian

Usage of pagination
----------------------

$page = $_REQUEST['page'] ? $_REQUEST['page'] : 1;
$maxRows = MAX_ROWS;
$from = ($page - 1) * $maxRows;

here we want to get the sql results from [$from] to [$maxRows]
ie  $sqlQuery .= LIMIT $from,$maxRows
and listing of the results are as usual in php

$totalResult = mysql_num_rows();
$path = "http://localhost/resultPage.php?sortBy={$_REQUEST['sortBy']}&";

$paginate = paginate($page,$totalResult,$_REQUEST['act'],$path);

and the answer is like this

Showing {$paginate['PAGINATE_FROM']} - {$paginate['PAGINATE_TO']} Of {$paginate['PAGINATE_TOTAL']} Results.
also

$paginate['PAGINATE']