forked from titat/project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgetQuery9.php
More file actions
22 lines (18 loc) · 725 Bytes
/
getQuery9.php
File metadata and controls
22 lines (18 loc) · 725 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/json; charset=UTF-8");
$appID = $_GET['appID'];
$conn = new mysqli("127.0.0.1", "root", "", "project_test");
$result = $conn->query("SELECT Room,SubjectName,SeatNo,Time(`Time`)AS Tim FROM examroom e JOIN subject s ON e.SubjectID = s.SubjectID WHERE AppID = '".$appID."';");
$outp = "[";
while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
if ($outp != "[") {$outp .= ",";}
$outp .= '{"Room":"' . $rs["Room"] . '",';
$outp .= '"SubjectName":"' . $rs["SubjectName"] . '",';
$outp .= '"SeatNo":"' . $rs["SeatNo"] . '",';
$outp .= '"Tim":"'. $rs["Tim"] . '"}';
}
$outp .="]";
$conn->close();
echo($outp);
?>