$kelas = $_POST['kelas'];
$sqlCount = "select count(nim_akhir) from mahasiswa where kelas = '$kelas' ";
$hasu = mysql_query($sqlCount);
$rsCount = mysql_fetch_array($hasu);
$banyakData = $rsCount[0];
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$limit = 5;
$mulai_dari = $limit * ($page - 1);
$sql_limit = "select * from mahasiswa where kelas = '$kelas' order by nim_akhir limit $mulai_dari, $limit ";
$hasil = mysql_query($sql_limit);
$kelas = $_GET['kelas'];
$sqlCount = "select count(nim_akhir) from mahasiswa where kelas = '$kelas' ";
$hasu = mysql_query($sqlCount);
$rsCount = mysql_fetch_array($hasu);
$banyakData = $rsCount[0];
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$limit = 5;
$mulai_dari = $limit * ($page - 1);
$sql_limit = "select * from mahasiswa where kelas = '$kelas' order by nim_akhir limit $mulai_dari, $limit ";
$hasil = mysql_query($sql_limit);
untuk menampilkan pagination,tambahkan parameter kelas:/membuat pagination
$banyakHalaman = ceil($banyakData / $limit);
echo 'Halaman: ';
for($i = 1; $i <= $banyakHalaman; $i++){
if($page != $i){
echo '|<a href="tampil-data-siswa.php?kelas='.$kelas.'&page='.$i.'">'.$i.'</a>| ';
}else{
echo "|$i| ";
}
}
//membuat pagination
$banyakHalaman = ceil($banyakData / $limit);
echo 'Halaman: ';
for($i = 1; $i <= $banyakHalaman; $i++){
if($page != $i){
echo '|<a href="coba.php?page='.$i.'&kelas='.$kelas.'">'.$i.'</a>| ';
}else{
echo "|$i| ";
}
}