-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathleaderboard.php
57 lines (57 loc) · 1.65 KB
/
leaderboard.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
<?php
include("functions/navbar.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Leaderboard</title>
<link rel="stylesheet" href="styles/style.css">
<style>
thead{
background-color:blue;
}
#ltable{
border-collapse: separate;
border-spacing: 2px;
margin: auto;
}
</style>
</head>
<body>
<div class="main">
<div class="box">
<h2>LeaderBoard</h2>
<?php
include("functions/dbconnect.php");
$con= $conn;
// $result = mysqli_query($con,"SELECT * FROM Scores");
$result = mysqli_query($con,"SELECT Username,Score FROM Scores");
echo "<table id = 'ltable' border='1'>";
$i = 0;
while($row = $result->fetch_assoc()){
if ($i == 0) {
$i++;
echo "<thead>";
echo "<tr>";
foreach ($row as $key => $value) {
echo "<th>" . $key . "</th>";
}
echo "</tr>";
echo "</thead>";
}
echo "<tr>";
foreach ($row as $value) {
echo "<td>" . $value . "</td>";
}
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
</div>
</div>
</body>
</html>