<?php
header('Content-Type: application/json'); // Must be JSON
include "config.php";
if (isset($_POST['kyc_id'])) {
    $kyc_id = mysqli_real_escape_string($con, $_POST['kyc_id']);

    // DO NOT ECHO THE QUERY
    $query = "SELECT id, bank_name, account_number, ifsc_code, account_holder, hold_amount, remarks 
              FROM bank_accounts 
              WHERE kyc_id = '$kyc_id'";

    $result = mysqli_query($con, $query);

    $data = [];
    while ($row = mysqli_fetch_assoc($result)) {
        $data[] = $row;
    }

    header('Content-Type: application/json');
    echo json_encode($data);
}
?>