<?php
require('../config/dbcon.php'); //connect
if (isset($_POST['search'])) {
    $search = $_POST['search'];
    $query = "Select party_name,id,party_address_one,party_address_two,party_place,party_contact_person,party_phone_number,party_mobile_number,party_gst_number,party_pan_number,party_aadhar_number,party_payment_terms,party_goods,party_remarks from party_mst where Lower(party_name) LIKE Lower('%" . $search . "%') or Lower(id) LIKE Lower('%" . $search . "%') order by party_name limit 10";
    $result = mysqli_query($connect, $query);
    while ($row = mysqli_fetch_array($result)) {
        $response[] = array("label" => $row['party_name'], "party_name" => $row['party_name'], "party_id" => $row['id'], "party_address_one" => $row['party_address_one'], "party_address_two" => $row['party_address_two'], "party_place" => $row['party_place'], "party_contact_person" => $row['party_contact_person'], "party_phone_number" => $row['party_phone_number'], "party_mobile_number" => $row['party_mobile_number'], "party_gst_number" => $row['party_gst_number'], "party_pan_number" => $row['party_pan_number'], "party_aadhar_number" => $row['party_aadhar_number'], "party_payment_terms" => $row['party_payment_terms'], "party_goods" => $row['party_goods'], "party_remarks" => $row['party_remarks']);
    }
    echo json_encode($response);
}
exit;
