<?php
include_once 'config/db.php';

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

    // Prepare delete query
    $stmt = $pdo->prepare("DELETE FROM updates WHERE id = :id");
    $stmt->bindParam(':id', $updateId, PDO::PARAM_INT);

    if ($stmt->execute()) {
        header('Location: daily_updates.php'); // Redirect after deletion
        exit;
    } else {
        echo "Error deleting the update.";
    }
} else {
    echo "No update ID provided.";
}
?>
