<?php
header('Content-Type: application/json');
include_once('../includes/config.php');

$query = "SELECT * FROM tblcustomers ORDER BY CustomerName";
$result = mysqli_query($con, $query);

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

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