<?php
include 'connect.php';

$search = $_GET['search'];

$query = "SELECT id, name FROM customer WHERE name LIKE '%$search%'";
$result = mysqli_query($conn, $query);

$data = array();
while ($row = mysqli_fetch_assoc($result)) {
    $data[] = array(
        'label' => $row['name'],
        'value' => $row['id']
    );
}

mysqli_close($conn);

echo json_encode($data);
?>
