This example demonstrates how data from a database table is displayed as different pages in a webpage.
In this example records per page is stored in a variable $pagesize and it is set to 15 (you can change it as per your requirements). For each page the query is selecting only the required 15 records and displays it.
In this example records per page is stored in a variable $pagesize and it is set to 15 (you can change it as per your requirements). For each page the query is selecting only the required 15 records and displays it.
Starting record of the given page ($pageno) is calculated by the following expression.
$start_rec = (($pageno-1) * $pagesize) ;
Query to select required number of records starting from start_rec is given below. To specify the starting record and number of records in SQL query the LIMIT clause is used.