<?php
// fetch.php
require 'config.php';
$since = intval($_GET['since'] ?? 0);
$stmt = $pdo->prepare("SELECT * FROM messages WHERE id > ? ORDER BY id ASC LIMIT 200");
$stmt->execute([$since]);
$rows = $stmt->fetchAll();
header('Content-Type: application/json');
echo json_encode($rows);
