-
Notifications
You must be signed in to change notification settings - Fork 0
/
delete_student.php
36 lines (28 loc) · 1.02 KB
/
delete_student.php
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
<?php
//Include constants.php file here
include('server.php');
// 1. get the ID of Admin to be deleted
$roll = $_GET['roll'];
//2. Create SQL Query to Delete Admin
$sql = "DELETE FROM users WHERE roll=$roll";
//Execute the Query
$res = mysqli_query($db, $sql);
// Check whether the query executed successfully or not
if($res==true)
{
//Query Executed Successully and Admin Deleted
//echo "Admin Deleted";
//Create SEssion Variable to Display Message
$_SESSION['delete'] = "<div class='success'>Student Deleted Successfully.</div>";
//Redirect to Manage Admin Page
header('location:'.SITEURL.'manage_users.php');
}
else
{
//Failed to Delete Admin
//echo "Failed to Delete Admin";
$_SESSION['delete'] = "<div class='error'>Failed to Delete student. Try Again Later.</div>";
header('location:'.SITEURL.'manage_users.php');
}
//3. Redirect to Manage Admin page with message (success/error)
?>