<?php
include('partials/menu.php');
//incude constants.php file here
include("../config/constants.php");
//get the id of the admin to be delete
$id = $_GET['id'];
//query to delete
$sql = "DELETE FROM tbl_admin where id=$id";
//execute the query
$res = mysqli_query($conn, $sql);
//check whether the query is executed succefully
if($res==TRUE){
  //QUERY EXECUTED Successfully
  //create session var to display msg
  $_SESSION['delete'] = "<div class='success'>Admin Deleted Successfully.</div>";
  //redirect to manage admin page
  header('location:' .SITEURL.'backend/manage-admin.php');
}
else {
  //FAILED TO EXECUTE
  $_SESSION['delete'] = "<div class='error'>Failed to Delete Admin.Try Again Later.</div>";
  header('location:' .SITEURL.'backend/manage-admin.php');
}
//redirect to the manage admin and display a msg (succefully deleted or error)

?>
