<?php
require('../config/dbcon.php'); //connect
if (isset($_POST['search'])) {
    $search = $_POST['search'];
    $query = "Select supplier_name,id,supp_address_one,supp_address_two,supp_place,supp_contact_person,supp_mobile_number,supp_pan_number,supp_bank_name,supp_bank_acc_number,supp_bank_branch,supp_ifsc_code,supp_supp_aadhar_no,supp_remarks from supp_mst where Lower(supplier_name) LIKE Lower('%" . $search . "%') or Lower(id) LIKE Lower('%" . $search . "%') order by supplier_name limit 10";
    $result = mysqli_query($connect, $query);
    while ($row = mysqli_fetch_array($result)) {
        $response[] = array("label" => $row['supplier_name'], "value" => $row['supplier_name'], "supp_id" => $row['id'], "supp_address_one" => $row['supp_address_one'], "supp_address_two" => $row['supp_address_two'], "supp_place" => $row['supp_place'], "supp_contact_person" => $row['supp_contact_person'], "supp_mobile_number" => $row['supp_mobile_number'], "supp_pan_number" => $row['supp_pan_number'], "supp_bank_name" => $row['supp_bank_name'], "supp_bank_acc_number" => $row['supp_bank_acc_number'], "supp_bank_branch" => $row['supp_bank_branch'], "supp_ifsc_code" => $row['supp_ifsc_code'], "supp_supp_aadhar_no" => $row['supp_supp_aadhar_no'], "supp_remarks" => $row['supp_remarks']);
    }
    echo json_encode($response);
}
exit;
