query($sql); $rows = $rows->num_rows; $sqlo = "select * from sekolah where (sub_kuliah='".$dt."') and tampil='YA' and jenis='Sekolah' order by bayar,urut asc limit $start,$limit"; $sql = stripslashes($sqlo); $data = $con->query($sql); $str=''; $i=0; $data_web = mysqli_query($con,"SELECT * from web"); $row2 = mysqli_fetch_object($data_web); while($row = $data->fetch_array(MYSQLI_ASSOC)){ $ptng_nama = substr($row['nama_sekolah'],0,20); $ptng_alamat = substr($row['alamat'],0,30); if ($row['paket']=="Free") { $jd = $row['kode']; $data_sl = mysqli_query($con,"SELECT count(kode) as counter FROM `sekolah_kunjungan` where kode ='".$row['kode']."' and tgl_kunjungan between '".$row2->range_awal."' AND '".$row2->range_akhir."' "); $sl = mysqli_fetch_object($data_sl); $data_dk = mysqli_query($con,"SELECT count(kode) as counter FROM `sekolah_dukung` where kode ='".$row['kode']."'"); $dk = mysqli_fetch_object($data_dk); $str.="
".$ptng_nama."
Dilihat : ".$sl->counter."
: ".$ptng_alamat."
"; } else if ($row['paket']=="Statis_Premium" and $row['diskon']=="Ya" or $row['paket']=="Slideshow_Premium" and $row['diskon']=="Ya" or $row['paket']=="Flash_Premium" and $row['diskon']=="Ya") { $jd = $row['link']; $data_sl = mysqli_query($con,"SELECT count(kode) as counter FROM `sekolah_kunjungan` where kode ='".$row['kode']."' and tgl_kunjungan between '".$row2->range_awal."' AND '".$row2->range_akhir."' "); $sl = mysqli_fetch_object($data_sl); $str.="
".$ptng_nama."
Dilihat : ".$sl->counter."
: ".$ptng_alamat."
"; } else { $jd = $row['link']; $data_sl = mysqli_query($con,"SELECT count(kode) as counter FROM `sekolah_kunjungan` where kode ='".$row['kode']."' and tgl_kunjungan between '".$row2->range_awal."' AND '".$row2->range_akhir."' "); $sl = mysqli_fetch_object($data_sl); $str.="
".$ptng_nama."
Dilihat : ".$sl->counter."
: ".$ptng_alamat."
"; } $i++; } echo $str; pagination($limit,$adjacent,$rows,$page); } function pagination($limit,$adjacents,$rows,$page){ $pagination=''; if ($page == 0) $page = 1; //if no page var is given, default to 1. $prev = $page - 1; //previous page is page - 1 $next = $page + 1; //next page is page + 1 $prev_=''; $first=''; $lastpage = ceil($rows/$limit); $next_=''; $last=''; if($lastpage > 1) { //previous button if ($page > 1) $prev_.= "<"; else{ //$pagination.= "previous"; } //pages if ($lastpage < 5 + ($adjacents * 2)) //not enough pages to bother breaking it up { $first=''; for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination.= "$counter"; else $pagination.= "$counter"; } $last=''; } elseif($lastpage > 3 + ($adjacents * 2)) //enough pages to hide some { //close to beginning; only hide later pages $first=''; if($page < 1 + ($adjacents * 2)) { for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) { if ($counter == $page) $pagination.= "$counter"; else $pagination.= "$counter"; } $last.= ">>"; } //in middle; hide some front and some back elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $first.= "<<"; for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) { if ($counter == $page) $pagination.= "$counter"; else $pagination.= "$counter"; } $last.= ">>"; } //close to end; only hide early pages else { $first.= "<<"; for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination.= "$counter"; else $pagination.= "$counter"; } $last=''; } } if ($page < $counter - 1) $next_.= ">"; else{ //$pagination.= "next"; } $pagination = "
".$first.$prev_.$pagination.$next_.$last; //next button $pagination.= "
\n"; } echo "

".$pagination."
"; } ?>