query("SELECT * FROM notifications ORDER BY created_at DESC LIMIT 5"); $notifications = $stmt->fetchAll(PDO::FETCH_ASSOC); echo json_encode(['success' => true, 'data' => $notifications]); } catch(PDOException $e) { echo json_encode(['success' => false, 'message' => 'Error fetching notifications: ' . $e->getMessage()]); } ?>