-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdelete-employee.php
More file actions
33 lines (25 loc) · 759 Bytes
/
delete-employee.php
File metadata and controls
33 lines (25 loc) · 759 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
33
<?php
//connect to database
$servername = "localhost";
$username = "root";
$password = "";
$database = "php_employee_management";
//Create Connection
$connection = new mysqli($servername, $username, $password, $database);
//Check connection stablished or not!
if ($connection->connect_error) {
die("Connection failed: " . $connection->connect_error);
}
if (isset($_GET["id"])) {
#if not exist then
$id = $_GET['id'];
$sql = "DELETE FROM employee WHERE id=$id";
$result = $connection->query($sql);
// if (!$result) {
// die("Invalid query : " . $connection->error);
// break;
// }
}
header("location: ./index.php");
exit;
?>