I'm trying to add pagination to my php script, but it didn't work and always show me http error 500
And if I delete the pagination code, it doesn't show the HTTP error 500
plz help me find the solution
pagination code:
$batas = 5;
$halaman = isset($_GET['halaman'])?(int)$_GET['halaman'] : 1;
$halaman_awal = ($halaman>1) ? ($halaman * $batas) - $batas : 0;
$previous = $halaman - 1;
$next = $halaman + 1;
$data = mysqli_query($koneksi,"select * from tbl_files");
$jumlah_data = mysqli_num_rows($data);
$total_halaman = ceil($jumlah_data / $batas);
$data_pegawai = mysqli_query($koneksi,"select * from pegawai limit $halaman_awal, $batas");
$nomor = $halaman_awal+1;
while($d = mysqli_fetch_array($data_pegawai);
html code:
<?php
for($x=1;$x<=$total_halaman;$x++){
?>
<li class="page-item"><a class="page-link" href="?halaman=<?php echo $x ?>"><?php echo $x; ?></a></li>
<?php
}
?>