<?php
include('db_connection.php');
session_start();

if (isset($_GET['notif_id'])) {
    $notif_id = intval($_GET['notif_id']);
    
    // Update the notification status to 'read'
    $stmt = $conn->prepare("UPDATE group_notifications SET is_read = TRUE WHERE notification_id = ?");
    $stmt->bind_param('i', $notif_id);

    if ($stmt->execute()) {
        echo "Notification marked as read.";
    } else {
        echo "Error: " . $stmt->error;
    }

    $stmt->close();
} else {
    echo "Invalid notification ID.";
}

$conn->close();

// Redirect back to the notifications page (adjust the path as necessary)
header("Location: group_notification_display.php");
exit;
?>
