Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- echo "<h2 class='head'>DATA KARYAWAN</h2>
- <table>
- <td>
- <div>
- <input type=button value='Tambah Data' onclick=\"window.location.href='?module=pegawai&act=input';\">
- </div>
- </td>
- </table>
- <table class='tabel'>
- <thead>
- <tr>
- <td><center>No.</center></td>
- <td><center>NIK</center></td>
- <td><center>Nama Lengkap</center></td>
- <td><center>Tanggal Masuk</center></td>
- <td><center>Bagian</center></td>
- <td><center>Jabatan</center></td>
- <td><center>Control</center></td>
- </tr>
- </thead>";
- $batas = 15;
- $pg = isset($_GET['pg']) && !empty($_GET['pg'])?$_GET['pg']:1;
- $posisi = ($pg-1)* $batas;
- $tampil=mysql_query(
- "
- SELECT 0 as nip,COUNT(*) as nama,null,null,null
- FROM pegawai
- UNION
- SELECT a.nip,a.nama,a.tgl_masuk,b.n_bag,c.n_jab
- FROM pegawai a
- JOIN bagian b USING(id_bag)
- JOIN jabatan c USING(id_jab)
- ORDER BY nip ASC
- LIMIT $posisi, $batas
- ");
- $no=$posisi;
- $d=mysql_fetch_assoc($tampil);
- while($dt=mysql_fetch_assoc($tampil)){
- echo "
- <tr>
- <td><center>".(++$no)."</center></td>
- <td><center>{$dt['nip']}</center></td>
- <td>{$dt['nama']}</td>
- <td><center>{$dt['tgl_masuk']}</center></td>
- <td><center>{$dt['n_bag']}</center></td>
- <td><center>{$dt['n_jab']}</center></td>
- <td><center><span><a href='?module=pegawai&act=edit&id={$dt['nip']}'>Edit</a></span>
- <span>
- <a href=\"$aksi?module=pegawai&act=hapus&id={$dt['nip']}\"
- onClick=\"return confirm('Apakah Anda benar-benar mau menghapusnya?')\">Hapus</a></span>
- <span><a href='?module=pegawai&act=detail&id={$dt['nip']}'>Detail</a></span></center></td>
- </tr>";
- }
- echo "
- </table>
- ";
- $jml_data = $d['nama'];
- //Jumlah halaman
- $JmlHalaman = ceil($jml_data/$batas); //ceil digunakan untuk pembulatan keatas
- //Navigasi ke sebelumnya
- $prev = ( $pg > 1 )?"<a href='?pg=".($pg-1)."'>Sebelumnya </a>":"Sebelumnya ";
- //Navigasi nomor
- $nmr = '';
- for ( $i = 1; $i<= $JmlHalaman; $i++ ){
- $nmr .= ( $i == $pg )?$i . " ":"<a href='?pg=$i'>$i</a> ";
- }
- //Navigasi ke selanjutnya
- $next = ( $pg < $JmlHalaman )?" <a href='?pg=".($pg + 1)."'>Selanjutnya</a>":" Selanjutnya";
- //Tampilkan navigasi
- echo $prev . $nmr . $next;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement