-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhapus_tamu.php
More file actions
32 lines (25 loc) · 800 Bytes
/
Copy pathhapus_tamu.php
File metadata and controls
32 lines (25 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
// Koneksi ke database
$host = "localhost";
$user = "root";
$pass = "";
$db = "fadhildb";
$conn = mysqli_connect($host, $user, $pass, $db);
// Memeriksa koneksi
if (!$conn) {
die("Koneksi gagal: " . mysqli_connect_error());
}
// Mengambil ID tamu yang akan dihapus
$id_bukutamu = $_GET['id_bukutamu'];
// Query untuk menghapus tamu dari tabel
$query = "DELETE FROM bukutamu WHERE id_bukutamu = '$id_bukutamu'";
$result = mysqli_query($conn, $query);
if ($result) {
echo "Data tamu berhasil dihapus.";
} else {
echo "Terjadi kesalahan saat menghapus data tamu: " . mysqli_error($conn);
}
mysqli_close($conn);
//mengalihkan halaman kembali ke index.php
header("location:daftar.php") ;
?>