Advertisement
kuchuz

Tugas 9 PWEB-D hapus.php

Dec 31st, 2021
1,245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.44 KB | None | 0 0
  1. <?php
  2.  
  3. include("config.php");
  4.  
  5. if( isset($_GET['id']) ){
  6.  
  7.     // ambil id dari query string
  8.     $id = $_GET['id'];
  9.  
  10.     // buat query hapus
  11.     $sql = "DELETE FROM calon_siswa WHERE id=$id";
  12.     $query = mysqli_query($db, $sql);
  13.  
  14.     // apakah query hapus berhasil?
  15.     if( $query ){
  16.         header('Location: list-siswa.php');
  17.     } else {
  18.         die("gagal menghapus...");
  19.     }
  20.  
  21. } else {
  22.     die("akses dilarang...");
  23. }
  24.  
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement