$per_page = 3;
$page_query = mysql_query("SELECT COUNT(*) FROM penjualan");
$pages = ceil(mysql_result($page_query, 0) / $per_page);
$page = (isset($_GET['pagenum'])) ? (int)$_GET['pagenum'] : $pages;
$start = ($page - 1) * $per_page;
$query = mysql_query("SELECT * FROM penjualan ORDER BY nonota ASC LIMIT $start, $per_page");
while($r=mysql_fetch_array($query)){
echo "
<tr>
<td><a href='?page=penjualan¬a=$r[nonota]'>$r[nonota]</a></td>
<td>$r[tanggal]</td>
<td>$r[total]</td>
<td><a href='?page=penjualan¬a=$r[nonota]'>Cetak Nota</a></td>
</tr>";
}
if($pages >= 1 && $page <= $pages){
for($halaman=1; $halaman<=$pages; $halaman++){
echo ($halaman == $page) ? '<a class="halaman-aktif">'.$halaman. '</a>' : '<a href="?page=penjualan&pagenum='.$halaman.'"> '.$halaman.'</a>'; }
}
Hello
I have a list of ....data... that is displayed 3 per page with the LIMIT clause.
i want when im going to this addres ?page=penjualan¬a=5
the pagination is on page 2..
other example when im going to this addres page=penjualan¬a=8
the pagination is on page 3..
because item $per_page
is only 3..
pls help me.. thanks very much