anybody help me how make a paging with php like indeed.com.
Note: 1. page view is : 1,2,3,4, .... 2. But ?start=10, ?start=20, ...
anybody help me how make a paging with php like indeed.com.
Note: 1. page view is : 1,2,3,4, .... 2. But ?start=10, ?start=20, ...
The principle is as follows:
$total = 40; // total item count
$itemsPerPage = 10;
$pages = ceil($total / $itemsPerPage);
echo '<ul>';
for ($i = 0; $i < $pages; ++$i) {
echo '<li><a href="?start=' . ($i * $itemsPerPage) . '">' . ($i + 1) . '</a></li>';
}
echo '</ul>';
Decent article on how to do this in PHP and MySQL http://www.php-mysql-tutorial.com/wikis/php-tutorial/paging-using-php.aspx