<?php
include("../include/config.php");

error_reporting(E_ALL);
ini_set('display_errors', 1);

$brand = $_POST['company_brand_select'];
$sql = "SELECT * FROM tbl_car WHERE brand_id = $brand";

$rs_result = mysqli_query($db, $sql);
$users = [];
while ($row = mysqli_fetch_array($rs_result)) {
    $user = [
        'id' => $row['id'],
        'name' => $row['name']
    ];
    $users[] = $user;
}

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

// Return the users array as a JSON response
echo json_encode($users);
?>
 