forked from titat/project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueryID.php
More file actions
25 lines (25 loc) · 792 Bytes
/
queryID.php
File metadata and controls
25 lines (25 loc) · 792 Bytes
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
$studentID = $_GET['studentID'];
$appID = $_GET['appID'];
$programID = $_GET['programID'];
$outp ="[";
$conn=mysqli_connect("127.0.0.1","root","","project_test");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$sql = "SELECT AppID, StudentID, fName, lName FROM student WHERE ProgramID ='".$programID."'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_array(MYSQLI_ASSOC)) {
if ($outp != "[") {$outp .= ",";}
$outp .= '{"AppID":"'. $row["AppID"].'",';
$outp .= '"StudentID":"'. $row["StudentID"].'",';
$outp .= '"fName":"'. $row["fName"].'",';
$outp .= '"lName":"'. $row["lName"]. '"}';
}
}
$outp.="]";
$conn->close();
echo ($outp)
?>