<?php include "check_login.php"; ?>
<?php
include 'dbcon.php';
$q = "SELECT id, title, message, link, created_at
      FROM notifications
      WHERE role='admin' AND is_seen=0
      ORDER BY id DESC
      LIMIT 10";

$res = mysqli_query($conn, $q);

$data = [];
while ($row = mysqli_fetch_assoc($res)) {
    $data[] = $row;
}

echo json_encode($data);
?>