-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestion_review.php
45 lines (44 loc) · 1.03 KB
/
question_review.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html>
<head>
<title>Welcome!</title>
</head>
<body>
<h3> Hello admin </h3>
<p> Here you can review the answers given to each question for all users. </p>
<?php
$servername = "localhost";
$user = "owen";
$pass = "mynewpassword";
$dbname = "Questionaire";
// Create connection
$conn = mysqli_connect($servername, $user, $pass, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$query = $conn->query("SELECT questions FROM Questions;");
$array = Array();
while($result = $query->fetch_assoc()){
$array[] = $result['questions'];
}
$count=1;
foreach($array as $entry){
echo $count,". ", $entry, '<br><br>';
$count++;
}
$query2="SELECT * FROM Answers";
$results = mysqli_query($conn,$query2);
while ($row = mysqli_fetch_assoc($results)) {
echo '<tr>';
foreach($row as $field) {
echo '<td>' . htmlspecialchars($field) . '</td><br>';
}
echo '</tr>';
}
?>
<form action="front_page.php">
<input type="submit" value="Return to home" />
</form>
</body>
</html>