<?php
require('../config/dbcon.php'); //connect
if (isset($_POST['truck_owner_name'])) {
    $truck_owner_name = $_POST['truck_owner_name'];
    //$query = "Select distinct(truck_owner_name) from truck_mst where Lower(truck_owner_name) LIKE Lower('%" . $search . "%') order by truck_owner_name limit 20";
    $query = "Select truck_number,id,truck_owner_name,truck_address_one,truck_address_two,truck_place,truck_mobile_number,truck_pan_number,truck_bank_name,truck_bank_acc_number,truck_bank_branch,truck_ifsc_code,truck_aadhar_no,truck_remarks from truck_mst where Lower(truck_owner_name) LIKE Lower('%" . $truck_owner_name . "%') order by truck_owner_name limit 20";
    $result = mysqli_query($connect, $query);
    while ($row = mysqli_fetch_array($result)) {
        $response[] = array("label" => $row['truck_owner_name'], "truck_id" => $row['id'], "truck_number" => $row['truck_number'], "truck_owner_name" => $row['truck_owner_name'], "truck_address_one" => $row['truck_address_one'], "truck_address_two" => $row['truck_address_two'], "truck_place" => $row['truck_place'], "truck_mobile_number" => $row['truck_mobile_number'], "truck_pan_number" => $row['truck_pan_number'], "truck_bank_name" => $row['truck_bank_name'], "truck_bank_acc_number" => $row['truck_bank_acc_number'], "truck_bank_branch" => $row['truck_bank_branch'], "truck_ifsc_code" => $row['truck_ifsc_code'], "truck_aadhar_no" => $row['truck_aadhar_no'], "truck_remarks" => $row['truck_remarks']);
    }
    echo json_encode($response);
}
exit;