<?php
include 'db.php';

$division = $_GET['division'];

$sql = "SELECT block FROM Location WHERE division = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $division);
$stmt->execute();
$result = $stmt->get_result();

$blocks = array();
while($row = $result->fetch_assoc()) {
    $blocks[] = $row['block'];
}

echo json_encode($blocks);
$stmt->close();
$conn->close();
?>
