Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- asumsi punya tabel db dengan nama daftar dan kolom no_pendaftaran dan nama
- save file dengan nama index.php
- <?php
- include("../dbkoneksi.php"); // menghubungkan ke file koneksi.php agar terhubung dengan database
- $link = koneksi_db();
- $q = mysql_query("Select * from daftar") or die (mysql_error();
- while ($data = mysql_fetch_array($q)) {
- ?>
- <table>
- <tr>
- <td> No_pendaftara </td>
- <td> Nama </td>
- <td> Aksi </td>
- </tr>
- <tr>
- <td><?php echo $data['no_pendaftaran']; ?> </td>
- <td><?php echo $data['nama']; ?> </td>
- <td><a href="hapus.php?no_pendaftaran=<?php echo $data['no_pendaftaran']; ?> </td>
- </tr>
- </table>
- <?php
- }
- ?>
- kemudain buat file hapus.php isi dengan script
- <?php
- include("../dbkoneksi.php"); // menghubungkan ke file koneksi.php agar terhubung dengan database
- $link = koneksi_db();
- $no_pendaftaran = $_GET['no_pendaftaran'];
- $query_hapus = mysql_query("DELETE FROM daftar WHERE no_pendaftaran = '$no_pendaftaran'");
- if ($query_hapus){
- ?><script>document.location.href="sukses.php"</script><?php
- }else{//jika gagal menghapus
- echo "Gagal : ".mysql_error();
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement