<?php
include('db_connection.php'); // Include your database connection file

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

    // Query to delete activity
    $query = "DELETE FROM upcoming_activities WHERE activity_id = ?";
    $stmt = $conn->prepare($query);
    $stmt->bind_param("i", $activity_id);

    if ($stmt->execute()) {
        echo "Activity deleted successfully!";
    } else {
        echo "Error: " . $conn->error;
    }

    $stmt->close();
    $conn->close();
    header('Location: admin_dashboard.php'); // Redirect to the admin dashboard
    exit();
} else {
    die('Error: Activity not found.');
}
?>
