forked from harshnsdalai/Incubation-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete.php
More file actions
27 lines (22 loc) · 678 Bytes
/
delete.php
File metadata and controls
27 lines (22 loc) · 678 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
<?php
$id = $_GET['id'];
//Connect DB
//Create query based on the ID passed from you table
//query : delete where Staff_id = $id
// on success delete : redirect the page to original page using header() method
$dbname = "incubation";
$conn = mysqli_connect("localhost", "root", "", $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
// sql to delete a record
$sql = "DELETE FROM incubation WHERE id = $id";
if (mysqli_query($conn, $sql)) {
mysqli_close($conn);
header('Location: admin.php'); //If book.php is your main page where you list your all records
exit;
} else {
echo "Error deleting record";
}
?>