-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservice2.php
25 lines (20 loc) · 870 Bytes
/
service2.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
<?php
require('dbConnect.php');
$sql = "SELECT data_sensor.no, data_sensor.id_alat, id_alat.nama_alat, data_sensor.ketinggian, id_lokasi.longitude, id_lokasi.latitude, id_lokasi.alamat, data_sensor.status, data_sensor.reading_time FROM data_sensor, id_alat, id_lokasi WHERE data_sensor.id_alat=id_alat.id_alat AND id_alat.id_lokasi=id_lokasi.id_lokasi AND data_sensor.id_alat='sensorA2' ORDER BY no ";
$sql2 = "SET time_zone ='+07:00'
";
$rs2 = mysqli_query($con,$sql2);
$result = $con->query($sql);
if ($result->num_rows > 0) {
// output data of each row
$obj = array();
while($row = $result->fetch_assoc()) {
$element = array($row["no"],$row["nama_alat"],$row["ketinggian"],$row["reading_time"]);
array_push($obj,$element);
}
echo json_encode($obj);
} else {
echo "0 results";
}
$con->close();
?>