-
Notifications
You must be signed in to change notification settings - Fork 0
/
Index.php
54 lines (48 loc) · 1.13 KB
/
Index.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
<?php include 'database.php'; ?>
<?php
//get the total numer of questions
$query = "SELECT * FROM `questions`";
//Get result
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
//sum total number of rows
$total = $result->num_rows;
//output number of estimated minutes quiz will take assuming each
//question takes 30 seconds
$estimated_time = ($total * 30) / 60;
?>
<!DOCTYPE html>
<html>
<head>
<title>Quizzer</title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
<header>
<div class = "container">
<h1>Quizzer</h1>
</div>
</header>
<main>
<div class = "container">
<h2>Test Your PHP Knowledge</h2>
<p>This is a multiple choice quiz to test your knowledge of php</p>
<ul>
<li>
<strong>Number of Questions: <?php echo $total ?></strong>
</li>
<li>
<strong>Type: Multiple Choice </strong>
</li>
<li>
<strong>Estimated Time: <?php echo $estimated_time.' minutes' ?></strong>
</li>
</ul>
<a href = "question.php?n=1" class = "start">Start</a>
</div>
</main>
<footer>
<div class = "container">
Copywrite 2015
</div>
</body>
</html>