1){ $prevPage = $curPage-1; $str.=" ".makeLink("Sebelumnya","?com=uu&p=".$prevPage)." "; } /*-------------------------Untuk Page Number----------------*/ for($i=1;$i<=$totalPage;$i++){ if($i==$curPage){ $bold=true; }else{ $bold=false; } $str.=" ".makeLink($i,"?com=uu&p=".$i,$bold)." "; } /*--------------------------Tombol Next-----------------------*/ if($curPage<$totalPage){ $nextPage=$curPage+1; $str.=" ".makeLink("Selanjutnya","?com=uu&p=".$nextPage)." "; } return $str; } function makeLink($str,$url,$bold="false"){ if($bold){ $str="".$str.""; } return ''.$str.''; } ?>
$total){$curPage=$total;} $maxRec=10; $startRec = ($curPage-1)*$maxRec; $sql = "select * from uu order by tahun desc,nomor desc limit ".$startRec.",".$maxRec; $rs=mysql_query($sql,$dbh); //$mainpage = "select * from uu order by id_uu desc"; //if (!$res = mysql_query($mainpage, $dbh)) //{ //echo mysql_error(); //exit; //} while ($row = mysql_fetch_array($rs)) { echo"
Undang-Undang Nomor $row[nomor] Tahun $row[tahun]
Tentang $row[judul]"; echo"
Download Pdf"; echo"
"; } $total_record=mysql_query("select * from uu order by tahun desc,nomor desc",$dbh); $total_record=mysql_num_rows($total_record); echo "
Lihat Halaman : "; echo buat_paging($curPage,$total_record,$maxRec); echo "
"; ?>