-
Notifications
You must be signed in to change notification settings - Fork 11
/
getArea.php
34 lines (29 loc) · 797 Bytes
/
getArea.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
require "function/connection.php";
if(isset($_GET['action'])){
if( $_GET['action'] == "populate"){
$query = "SELECT distinct(`areaname``) as c FROM `area` WHERE 1";
$queryResult = $conn->query($query);
if($queryResult->num_rows > 0){
$r = array();
while($row = $queryResult->fetch_array(MYSQLI_ASSOC)){
$r[] = $row['c'];
}
echo json_encode($r);
$conn->close();
}
}
if( $_GET['action'] == "showArae"){
//echo json_encode($_GET['batch']);
$areaQuery = "select * from area where areaname='".$_GET['areaname']."'";
$areaQueryResult = $conn->query($areaQuery);
if($areaQueryResult->num_rows > 0){
$r = array();
while($row = $areaQueryResul->fetch_array(MYSQLI_ASSOC)){
$r[] = $row;
}
echo json_encode($r);
}
//else echo json_encode(["no data found"]);
}
}