CasperSecurity
<?php
session_start();
include '../../connection/connection.php';
$db_handle = new DBController();
$selecth=$db_handle-> runQuery("SELECT * FROM location ");
$db_handle = new DBController();
$selecthnum=$db_handle-> numRows("SELECT * FROM location ");
$last_row = $selecthnum - 1;
if($selecthnum >= 1){
echo '{"status": "1",
"data":[';
$i =1;
foreach($selecth as $resulth){
$location_id = $resulth['location_id'];
$room = $resulth['room_no'];
$location_name = $resulth['location_name'];
$floor = $resulth['floor'];
$building = $resulth['building'];
$street = $resulth['street'];
$city = $resulth['city'];
$state = $resulth['state'];
$utm_zone = $resulth['utm_zone'];
$utm_side_a = $resulth['utm_side_a'];
$utm_side_a_value = $resulth['utm_side_a_value'];
$utm_side_b = $resulth['utm_side_b'];
$utm_side_b_value = $resulth['utm_side_b_value'];
$latitude = $resulth['latitude'];
$longitude = $resulth['longitude'];
$altitude = $resulth['altitude'];
$location_id = $resulth['location_id'];
echo'
{
"Room":"'.$room.'",
"locationname":"'.$location_name.'",
"floor":"'.$floor.'",
"building":"'.$building.'",
"street":"'.$street.'",
"city":"'.$city.'",
"state":"'.$state.'",
"utm_zone":"'.$utm_zone.'",
"utm_side_a":"'.$utm_side_a.'",
"utm_side_a_value":"'.$utm_side_a_value.'",
"utm_side_b":"'.$utm_side_b.'",
"utm_side_b_value":"'.$utm_side_b_value.'",
"latitude":"'.$latitude.'",
"longitude":"'.$longitude.'",
"altitude":"'.$altitude.'",
"location_id":"'.$location_id.'"
}';
if($i <= $last_row){
echo ',';
}
$i++;
}
echo'
]}';
}else{
echo '{"status": "0",
"message":"Page Not found"
}';
}
?>