-
-
Notifications
You must be signed in to change notification settings - Fork 30
/
allquestions.php
85 lines (72 loc) · 2.2 KB
/
allquestions.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php session_start(); ?>
<?php include "connection.php";
if (isset($_SESSION['admin'])) {
?>
<!DOCTYPE html>
<html>
<head>
<title>PHP-Kuiz</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" href="css/style1.css">
</head>
<body>
<header>
<div class="container">
<h1>PHP-Kuiz</h1>
<a href="index.php" class="start">Home</a>
<a href="add.php" class="start">Add Question</a>
<a href="allquestions.php" class="start">All Questions</a>
<a href="players.php" class="start">Players</a>
<a href="exit.php" class="start">Logout</a>
</div>
</header>
<h1> All Questions</h1>
<table class="data-table">
<caption class="title">All kuiz questions</caption>
<thead>
<tr>
<th>Q.NO</th>
<th>Question</th>
<th>Option1</th>
<th>Option2</th>
<th>Option3</th>
<th>Option4</th>
<th>Correct Answer </th>
<th>Edit</th>
</tr>
</thead>
<tbody>
<?php
$query = "SELECT * FROM questions ORDER BY qno DESC";
$select_questions = mysqli_query($conn, $query) or die(mysqli_error($conn));
if (mysqli_num_rows($select_questions) > 0 ) {
while ($row = mysqli_fetch_array($select_questions)) {
$qno = $row['qno'];
$question = $row['question'];
$option1 = $row['ans1'];
$option2 = $row['ans2'];
$option3 = $row['ans3'];
$option4 = $row['ans4'];
$Answer = $row['correct_answer'];
echo "<tr>";
echo "<td>$qno</td>";
echo "<td>$question</td>";
echo "<td>$option1</td>";
echo "<td>$option2</td>";
echo "<td>$option3</td>";
echo "<td>$option4</td>";
echo "<td>$Answer</td>";
echo "<td> <a href='editquestion.php?qno=$qno'> Edit </a></td>";
echo "</tr>";
}
}
?>
</tbody>
</table>
</body>
</html>
<?php }
else {
header("location: admin.php");
}
?>