<?php
define('SUPPRESS_ERRORS', true);
header('Content-Type: application/json');

include_once('../../includes/config.php');

$query = "SELECT ID, LocationName FROM tbllocations WHERE Status = 'Active' ORDER BY LocationName";
$result = mysqli_query($con, $query);

$locations = [];
if ($result) {
    while ($row = mysqli_fetch_assoc($result)) {
        $locations[] = $row;
    }
}

echo json_encode(['success' => true, 'locations' => $locations]);
?>