<?php
session_start();
include "../include/config.php"; 

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


    $sql = "DELETE FROM assignments WHERE id = ?";
    $stmt = $conn->prepare($sql);
    $stmt->bind_param("i", $id);

    if ($stmt->execute()) {
        header("Location: assignment.php?error=Assignment deleted successfully");
    } else {
        header("Location: assignment.php?error=Failed to delete assignment");
    }
    exit();
} else {
    header("Location: assignment.php?error=No assignment ID provided");
    exit();
}
?>
