-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoveReversation.php
More file actions
41 lines (30 loc) · 1.08 KB
/
Copy pathRemoveReversation.php
File metadata and controls
41 lines (30 loc) · 1.08 KB
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
33
34
35
36
37
38
39
40
41
<?php
$passworddb = "";
if (isset($_GET['ReversationID'])) {
$ReversationID = $_GET['ReversationID'];
if (empty($ReversationID)) {
die("Error: ReversationID is required.");
}
$connection = mysqli_connect("localhost", "root", $passworddb, "library");
if (!$connection) {
die("Error: Connection failed - " . mysqli_connect_error());
}
$query = "DELETE FROM `reversation` WHERE `ReversationID` = ?";
$stmt = mysqli_prepare($connection, $query);
if ($stmt) {
mysqli_stmt_bind_param($stmt, "i", $ReversationID);
if (mysqli_stmt_execute($stmt)) {
header("Location: reservation.php?status=success&message=Reversation%20deleted%20successfully");
exit();
} else {
echo "Error: Could not delete Reversation - " . mysqli_stmt_error($stmt);
}
mysqli_stmt_close($stmt);
} else {
echo "Error: Could not prepare statement - " . mysqli_error($connection);
}
mysqli_close($connection);
} else {
echo "Error: ReversationID is missing in the request.";
}
?>