<?php
include 'koneksi.php';
$stmt = $pdo->query('SELECT COUNT(*) FROM chats WHERE is_read = 0 AND id_occupant NOT IN (SELECT id_occupant FROM occupant)');
$count = $stmt->fetchColumn();
echo "Total orphaned unread: " . $count;
?>