forked from katezach/FinalProjectPSPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathload_scoreboard.php
61 lines (48 loc) · 1.65 KB
/
load_scoreboard.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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="profile.css">
</head>
<body>
<table class="table">
<?php
include "SQL_connection.php";
$username="";
$score="";
$noofquiz="";
$counter=1;
$query = "SELECT * FROM scores ORDER BY Score DESC";
$result = mysqli_query($link,$query);
$num = mysqli_num_rows($result);
if ($num>0) {
echo '<thead>
<tr>
<th style = "font-size:16px;" scope="col">No.</th>
<th style = "font-size:16px;" scope="col">Username</th>
<th style = "font-size:16px;" scope="col">Score</th>
<th style = "font-size:16px;" scope="col">Quiz</th>
</tr>
</thead>
<tbody>' ;
while($row = mysqli_fetch_array($result)){
$username=$row['Username'];
$score=$row['Score'];
$noofquiz=$row['no_of_quiz'];
echo '<tr>
<td> <label style = "font-size:14px;">'; echo $counter; echo '</label></td>';
echo '<td> <label style = "font-size:14px;">'; echo $username ; echo'</label></td>';
echo '<td> <label style = "font-size:14px;">'; echo $score ; echo'</label></td>';
echo '<td> <label style = "font-size:14px;">'; echo $noofquiz ; echo'</label></td>
</tr>';
$counter = $counter + 1 ;
}
echo '</tbody>' ;
}
else{
echo 'No one has played a quiz yet !';
}
mysqli_close($link);
?>
</table>
</body>
</html>