<?php

require_once './connection.php';

$result = array();

$sql = 'select * from tbl_district where flag="1" ORDER by id ASC';
//echo 'query ' . $sql;
try {
    if ($con) {
        mysqli_set_charset($con, 'utf8');
        $response = mysqli_query($con, $sql);
//        print_r($response);
        if (mysqli_num_rows($response) > 0) {

            while ($row = mysqli_fetch_assoc($response)) {
                $index["id"] = $row["id"];
                $index["district"] = $row["district"];
                $index["district_hindi"] = $row["district_hindi"];
                $index["district_guj"] = $row["district_guj"];

                array_push($result, $index);
            }
//            $result["success"] = "1";
            echo json_encode($result);
        } else {
            echo 'NO_Record_Found';
        }
    } else {
        echo 'Connection Problem';
    }
} catch (Exception $ex) {
    echo $e->getMessage();
}
?>
