-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdelete-task.php
More file actions
30 lines (25 loc) · 774 Bytes
/
delete-task.php
File metadata and controls
30 lines (25 loc) · 774 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
<?php
include('config/constants.php');
if(isset($_GET['task_id']))
{
$task_id = $_GET['task_id'];
$conn = mysqli_connect(LOCALHOST, DB_USERNAME, DB_PASSWORD) or die(mysqli_error());
$db_select = mysqli_select_db($conn, DB_NAME) or die(mysqli_error());
$sql = "DELETE FROM tbl_tasks WHERE task_id=$task_id";
$res = mysqli_query($conn, $sql);
if($res==true)
{
$_SESSION['delete'] = "Task Deleted Successfully.";
header('location:index.php');
}
else
{
$_SESSION['delete_fail'] = "Failed to Delete Task";
header('location:index.php');
}
}
else
{
header('location:index.php');
}
?>