-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetdata.php
More file actions
57 lines (54 loc) · 1.87 KB
/
getdata.php
File metadata and controls
57 lines (54 loc) · 1.87 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
//Checking if data is exist
if(isset($_POST)){
if(isset($_POST['key'])){
//run using conn.php
include "conn.php";
if($_POST['key']=='getdataAx'){
$query = mysqli_query($mysqli,"SELECT Ax FROM iot ORDER BY ID DESC LIMIT 1;");
if(mysqli_num_rows($query)>0){
$response = "";
while($data = mysqli_fetch_array($query)){
$response .= "".$data['Ax'];
exit($response);
}
}else{
exit('nodata');
}
}elseif($_POST['key']=='getdataAy'){
$query = mysqli_query($mysqli,"SELECT Ay FROM iot ORDER BY ID DESC LIMIT 1;");
if(mysqli_num_rows($query)>0){
$response = "";
while($data = mysqli_fetch_array($query)){
$response .= "".$data['Ay'];
exit($response);
}
}else{
exit('nodata');
}
}elseif($_POST['key']=='getdataAz'){
$query = mysqli_query($mysqli,"SELECT Az FROM iot ORDER BY ID DESC LIMIT 1;");
if(mysqli_num_rows($query)>0){
$response = "";
while($data = mysqli_fetch_array($query)){
$response .= "".$data['Az'];
exit($response);
}
}else{
exit('nodata');
}
}elseif($_POST['key']=='getdataLabel'){
$query = mysqli_query($mysqli,"SELECT Label FROM iot ORDER BY ID DESC LIMIT 1;");
if(mysqli_num_rows($query)>0){
$response = "";
while($data = mysqli_fetch_array($query)){
$response .= "".$data['Label'];
exit($response);
}
}else{
exit('nodata');
}
}
}
}
?>