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

$user_id = $_GET['user_id'];

// Assume $user_id contains the current user ID

$sql = "SELECT new_notifications, last_notification, notification_message FROM user_notifications WHERE user_id = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("i", $user_id);
$stmt->execute();
$result = $stmt->get_result();
$data = $result->fetch_assoc();

$response = [
    'new_notifications' => $data['new_notifications'],
    'last_notification' => $data['last_notification'],
    'notification_message' => $data['notification_message']
];

echo json_encode($response);


$stmt->close();
$conn->close();
?>
