<?php
include('includes/config.php');
include('defs.php');

if (isset($_GET['id'])) {
    $id = mysqli_real_escape_string($link, $_GET['id']);
    $sql = "SELECT Name, Adress, City, Province, Contact_No, C_Person, Ctype, Warehouse, Salesman, Dued, C_Limit FROM acc_heads WHERE A_Id='$id'";
    $res = mysqli_query($link, $sql);

    if ($row = mysqli_fetch_assoc($res)) {
        echo json_encode([
            "name" => $row['Name'],
            "address" => $row['Adress'],
            "city" => $row['City'],
            "prov" => $row['Province'],
            "ctype" => $row['Ctype'],
            "cont" => $row['Contact_No'],
            "cper" => $row['C_Person'],
            "ware" => $row['Warehouse'],
             "sman" => $row['Salesman'],
              "dued" => $row['Dued'],
                 "clmt" => $row['C_Limit']
            
            
            
            

        ]);
    } else {
        echo json_encode(null);
    }
}
?>
