<?php
require '../db_connection.php';

header('Content-Type: application/json');

$sql = "SELECT id, nombre FROM sucursales ORDER BY nombre ASC";
$result = $conn->query($sql);

$sucursales = [];
if ($result->num_rows > 0) {
    while($row = $result->fetch_assoc()) {
        $sucursales[] = $row;
    }
}

echo json_encode($sucursales);

$conn->close();
?>
