-
Notifications
You must be signed in to change notification settings - Fork 3
/
achievementsinclude.php
52 lines (49 loc) · 1.55 KB
/
achievementsinclude.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
<?php
function OpenCon()
{
$dbhost = "sql6.freesqldatabase.com";
$dbuser = "sql6400897";
$dbpass = "gcysFbCvd9";
$db = "sql6400897";
$conn = new mysqli($dbhost, $dbuser, $dbpass,$db);
return $conn;
}
function CloseCon($conn)
{
$conn -> close();
}
$conn = OpenCon();
if($conn === false){
die("ERROR: Could not connect." . $conn->connect_error);
echo "<br>";
}
$sql1 = "SELECT * FROM persons";
$result = $conn->query($sql1);
echo '<h2 style="text-align: center; color: white;">Achievements</h1>';
echo '<style>
.score {
cursor: pointer;
}
</style>';
echo '<table id="leader"; style="margin-left: auto; margin-right: auto; margin-top: 50px; position: relative; width: calc(90vw - 2rem); max-width: 800px; border-spacing: 0 1rem; border: 1px solid rgba(255,255,255,0.3); color: white; border-collapse: collapse;">';
echo '<tr style="background-color: rgba(255, 255, 255, 0.3);">';
echo '<th style="padding-left: 2rem;">Name</th>';
echo '<th style="text-align: center">Achievements</th>';
echo '</tr>';
echo '<div style="border: 1px solid rgba(255,255,255,0.3);">';
if ($result) {
while($row = $result->fetch_assoc()) {
echo '<tr style= "border: 1px solid rgba(255,255,255,0.3); height: 2rem;">';
echo '<td style = "font-weight: 500; width: 10px; padding-left:2px;">';
echo $row["username"]."</td>";
echo '<td style = "padding-left: 1rem; font-size: 1.1rem; letter-spacing: 0.05rem; text-align:left">';
echo $row["achievements"]."</td>";
}
}
else
echo"No Data Available";
echo '</div>';
echo '</table>';
echo "<br><br><br>";
CloseCon($conn);
?>