query("SHOW TABLES LIKE 'ips'")->fetchColumn()) { json_out([]); } $st = db()->prepare('SELECT annee, ips, ips_dep FROM ips WHERE uai = ? ORDER BY annee'); $st->execute([$uai]); $out = []; foreach ($st as $r) { $out[] = [ 'annee' => (int) $r['annee'], 'ips' => (float) $r['ips'], 'ips_dep' => $r['ips_dep'] !== null ? (float) $r['ips_dep'] : null, ]; } json_out($out); } catch (Throwable $e) { json_error('Erreur : ' . $e->getMessage(), 500); }