<?php
require_once __DIR__ . "/../../config/db.php";
header("Content-Type: application/json");

$block_id = $_GET["block_id"] ?? "";
if (!$block_id) {
    echo json_encode([]);
    exit;
}

$stmt = $pdo->prepare("SELECT id, name FROM gps WHERE block_id = ? ORDER BY name");
$stmt->execute([$block_id]);
echo json_encode($stmt->fetchAll(PDO::FETCH_ASSOC));
