<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type');
require_once('../lib/dbclass.php');

$id = $_REQUEST['id'];








$id = $_REQUEST['id'];

if ($id > 0) {
    $data = findQuery('select * from tbl_ward where status=0 and panchayat_id in
(select id from tbl_panchayat where status=0 and assembly_id in
(select id from tbl_assembly where status=0 and district in
(select id from tbl_district where status=0 and id=10)))');
} else {
    $data = findQuery('select * from tbl_ward where status=0 and panchayat_id in
(select id from tbl_panchayat where status=0 and assembly_id in
(select id from tbl_assembly where status=0 and district in
(select id from tbl_district where status=0)))');
}








if ($data) {
    for ($i = 0;$i < count($data);$i++) {
        $message = 'true';

        $data2[] = [


                'id'       => $data[$i]['id'],
                'name'     => $data[$i]['ward_name'],
            'panchayat_id' => $data[$i]['ward_name'],



            ];
    }
} else {
    $message = 'false';
    $data2[] = ['error' => 'Not Found'];
}

echo json_encode(['Status' => $message, 'data' => $data2]);

return;

?>

