<!-- data table start -->
<div class="col-12 mt-5">
  <div class="card">
    <div class="card-body">
      <h4 class="header-title">Data Siswa</h4>
      <div class="data-tables">
        <a href="?page=Tambah-Siswa" target="_self"><button type="button" class="btn btn-primary mb-3">Tambah Data</button></a>
        <table id="dataTable2" class="text-center">
          <thead class="bg-light text-capitalize">
            <tr>
              <th width="5%">No</th>
              <th width="10%">NIS</th>
              <th width="25%">Nama Siswa</th>
              <th width="15%">Kelas</th>
              <th width="10%">Foto</th>
              <th width="35%">Aksi</th>
            </tr>
          </thead>
          <tbody>
            <?php
            include_once "../library/inc.sesadmin.php";
            include_once "../library/inc.library.php";

# UNTUK PAGING (PEMBAGIAN HALAMAN)
// $row = 100;
// $hal = isset($_GET['hal']) ? $_GET['hal'] : 0;
            $userSql = "SELECT siswa.nis, siswa.nama_siswa, siswa.foto, kelas_siswa.kdkelas, kelas.namakelas FROM siswa LEFT JOIN kelas_siswa ON siswa.nis=kelas_siswa.nis LEFT JOIN kelas ON kelas_siswa.kdkelas=kelas.kdkelas ORDER BY siswa.nis ASC";
            $userQry = mysql_query($userSql, $koneksidb) or die ("error paging: ".mysql_error());
// $jml   = mysql_num_rows($pageQry);
// $max   = ceil($jml/$row);
            $nomor  = 0; 
            while ($userRow = mysql_fetch_array($userQry)) {
              $nomor++;
              ?>
              <tr>
                <td><b><?php echo $nomor; ?></b></td>
                <td><?php echo $userRow['nis']; ?></td>
                <td align="left"><?php echo $userRow['nama_siswa'] ?></td>
                <td align="left"><?php echo $userRow['namakelas'] ?></td>
                <td><img src="../foto_siswa/<?php echo $userRow['foto'] ?>" width="100px"></td>
                <td align="center">
                 <a href="?page=Edit-Siswa&amp;Kode=<?php echo $userRow['nis']; ?>"><button type="button" class="btn btn-warning btn-xs">Ubah</button></a>
                 <a href="?page=Delete-Siswa&amp;Kode=<?php echo $userRow['nis']; ?>&KodeKelas=<?php echo $userRow['kdkelas']; ?>" target="_self" alt="Delete Data" onclick="return confirm('ANDA YAKIN INGIN MENGHAPUS DATA PENTING INI ... ?')"><button type="button" class="btn btn-danger btn-xs">Hapus</button></a>
               </td>
             </tr>
             <?php } ?>
           </tbody>
         </table>
       </div>
     </div>
   </div>
 </div>
<!-- data table end -->