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

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


if (isset($_REQUEST["flatno"])) {
    $flatno = $_REQUEST['flatno'];
    $accode = $_REQUEST['accode'];

    $query = "SELECT flatno,name,accode FROM `accmast` WHERE flatno ='$flatno'";
    $result = mysqli_query($conn, $query)or die(mysqli_error($conn));
    $r = mysqli_fetch_assoc($result);
    
    $rows = array();
    $ctr = 0;
    $rows = array('success' => true,
        'accode'   => "$r[accode]");
    header("Content-type: application\json");
    echo json_encode($rows);
}