<?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];
$fseries = $_SESSION["society_" . $dbname];
$keycond  = "and `series`= '$fseries'";

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

    
    $getm = mysqli_query($conn, "SELECT name, accode FROM accmast WHERE grpcode = '010' and `accode`='$flatno' $keycond")or die(mysqli_error($conn));
    $fetm = mysqli_fetch_array($getm);
    
    $name = $fetm['name'];
    $accode = $fetm['accode'];
    
    $rows = array('name' => $name, 'accode' => $accode);

    header("Content-type: application\json");
    echo json_encode($rows);
}