Wednesday, April 29, 2009

Paging in PHP

Paging is the concept which will be mostly used in any language like in java or dotnot or php. The main use of the paging will limit the number of records from displaying and make the user more clear about the records displayed. The concept of paging will be same in all the languages. You may take the dotnet or jsp or php the overall concept remains the same.
This may be the new concept but we may need the simpler version in writing the code. Here i am attachingthe code which may feel will be the simpler version, Any one can use this code.

In the downloaded files you will have the 2 php files and 1 database file. Run the script of the MYsql.

$start=$_GET['start']; // To take care global variable if OFF
if(!($start > 0)) { // This variable is set to zero for the first page
$start = 0;
}

$eu = ($start -0);
$limit = 8; // No of records to be shown per page.
$this1 = $eu + $limit;
$back = $eu - $limit;
$next = $eu + $limit;

Here we can change the no of records per page by changing the value of limit.



0 comments:

Post a Comment