-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquestion.php
More file actions
21 lines (20 loc) · 802 Bytes
/
question.php
File metadata and controls
21 lines (20 loc) · 802 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
include_once 'db/db_connection.php';
include_once 'app/Question.php';
$diseaseId = $_GET['diseaseId'];
$sql = "SELECT * FROM questions where disease_id='$diseaseId'";
$questions = array();
$result = mysqli_query($conn, $sql);
header('Content-type: text/javascript');
if (mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_array($result)) {
$question['id'] = $row['id'];
$question['question'] = $row['question'];
$question['disease_id'] = $row['disease_id'];
$question['answers'] = Question::getQuestionAnswers($row['id'],$conn);
array_push($questions, $question);
}
echo json_encode(['success' => true, 'questions' => $questions]);
} else {
echo json_encode(['success' => true, 'questions' => $questions]);
}