<?php
ob_start();
require("includes/check_auth_user.php");
require("includes/dbconnect.php");
include('includes/function.php');

$admin = $_SESSION["admin_" . $dbname];
$zdb = $_SESSION["zdbyear_" . $dbname];
mysqli_select_db($conn,$zdb);


if (isset($_REQUEST["custname"])) {
    $custname = $_REQUEST["custname"];
    
    $query = "SELECT `add1`, `add2`, `add3` FROM `accmast` WHERE accode='$custname'";

    $result = mysqli_query($conn,$query)or die(mysqli_error($conn));

    $rows = array();
    $ctr = 0;
    $r = mysqli_fetch_assoc($result);
    $rows = array('success' => true,
        'add1' => "$r[add1]",
        'add2' => "$r[add2]",
        'add3' => "$r[add3]");
    header("Content-type: application\json");
    echo json_encode($rows);

}
?>