<?php

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

$query = "SELECT id, name FROM districts ORDER BY name ASC";
$result = $conn->query($query);

$data = [];

while ($row = $result->fetch_assoc()) {
    $data[] = $row;
}

echo json_encode([
    "status" => true,
    "data" => $data
]);