Have a Snippet?

Keep, track and share your code snippets with your friends

PHP: Simple pagination

Simple PHP pagination uses a Twitter Bootstrap layout

$targetpage = "search.php";
$limit = 50; //Records per page
$total_pages = $total_count; //Total number of the records to paginate

$stages = 3;
$page = mysql_escape_string($_REQUEST['page']);
if ($page) {
    $start = ($page - 1) * $limit;
} else {
    $start = 0;
}
if ($page == 0) {
    $page = 1;
}
$prev = $page - 1;
$next = $page + 1;
$lastpage = ceil($total_pages / $limit);
$LastPagem1 = $lastpage - 1;

$paginate = '';
if ($lastpage > 1) {

    $paginate .= "";
}
echo $paginate;


Tag: PHP, Pagination, Bootstrap

0 Comments