saya coba buat no hal(seperti hal sangkep paling bawah), masalahnya ketika saya tambah data, malah satu baris penuh dengan nomor hal,...hehe...
gimana ya bung Ellyx untuk mebatasi agar no hal yang tampil ...?
<?php
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tbl_berita"),0);
$total_pages = ceil($total_results / $max_results);
echo "<center>Select a Page<br />";
if($halaman > 1){
$prev = ($page - 1);
echo "<a href=$_SERVER[PHP_SELF]?hal=$prev>« Previous </a> ";
}
for($i = 1; $i <= $total_pages; $i++){
if(($halaman) == $i){
echo "$i ";
} else {
echo "<a href=$_SERVER[PHP_SELF]?hal=$i>$i</a> ";
}
}
if($halaman < $total_pages){
$next = ($page + 1);
echo "<a href=$_SERVER[PHP_SELF]?hal=$next>Next »</a>";
}
echo "</center>";
?>
|