<?php
// Include session check for admin protection
include('session_check.php');

// Include database configuration
include('../../config/database.php');


if (isset($_GET['id'])) {
    $id = intval($_GET['id']);

    // Delete assessor from the database
    $sql = "DELETE FROM assessors WHERE id = ?";
    $stmt = $conn->prepare($sql);
    $stmt->bind_param("i", $id);

    if ($stmt->execute()) {
        $success = "Assessor deleted successfully!";
    } else {
        $errors[] = "Error deleting assessor: " . $conn->error;
    }

    $stmt->close();
}

$conn->close();

// Redirect to the add_assessor.php page
header("Location: add_assessor.php?success=" . urlencode($success));
exit();
?>
