<?php

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



$maindb = 'complaint';

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

$flatno = $_REQUEST["flatno"];

$qry = mysqli_query($conn, "SELECT  name,block,wing,floor,area,unit,mobile FROM `accmast` where `flatno` ='$flatno' ") or die(mysqli_error($conn));
$rows = array();
$ctr2 = 0;
$pctr2 = 1;
$row = mysqli_fetch_array($qry);
if ($row['unit'] == 'F') {
    $unit = 'Sq. Ft.';
}else{
    $unit = 'Sq. Mtr.';
}



//        $party1 = mysqli_query($conn,"SELECT name,accode from accmast where accode = $row[party]") or die(mysqli_error($conn));
//        $name = mysqli_fetch_array($party1);
    $rows[] = ['success' => true,
        'name' => $row['name'],
        'block' => $row['block'],
        'wing' => $row['wing'],
        'floor' => $row['floor'],
        'area' => $row['area'],
        'unit' => $unit,
        'mobile' => $row['mobile'],
    ];
    $ctr2++;


    header("Content-type: application/json");
    echo json_encode($rows);
    ?>