-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdelete.php
More file actions
26 lines (24 loc) · 710 Bytes
/
delete.php
File metadata and controls
26 lines (24 loc) · 710 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
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['delete'])) {
$id = $_POST['id'];
$conn = mysqli_connect('localhost', 'root', '', 'db_webuild');
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "DELETE FROM Submit WHERE id = ?";
$stmt = mysqli_prepare($conn, $sql);
mysqli_stmt_bind_param($stmt, 'i', $id);
if (mysqli_stmt_execute($stmt)) {
header("Location: C.php");
exit();
} else {
echo "Error: " . mysqli_error($conn);
}
mysqli_stmt_close($stmt);
mysqli_close($conn);
} else {
header("Location: C.php");
exit();
}
?>
<!-- this file is used to delete the submit record -->