-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstandings.php
80 lines (61 loc) · 1.69 KB
/
standings.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
<html>
<head>
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" />
<title>Wellness Spring Training</title>
<link rel='stylesheet' href="css/style.css?v=<?php echo time(); ?>">
<script src="js/script.js"></script>
</head>
<?php
include_once 'includes/dbconnect.inc.php';
$sqli = "SELECT name, runs FROM `teams` ORDER BY runs DESC LIMIT 10;";
$result = mysqli_query($conn, $sqli);
$rows = array();
while($r = mysqli_fetch_assoc($result)) {
$rows[] = $r;
};
$jsonData = json_encode($rows);
// print_r($jsonData)
?>
<script type="text/javascript">
const teams = <?php echo $jsonData;?>;
console.log(teams)
</script>
<body>
<div id="headerDiv">
<div id="logoDiv">
<a href="https://wfrc.org/">
<img src="graphics/logo.png" id="logo" >
</a>
</div>
<div id="titleDiv">
<h1 >Standings!</h1>
</div>
</div>
<div class="flex-container">
<br>
<?php if (count($rows) > 0): ?>
<div id="standingsDiv">
<table>
<tr>
<th>Team Name</th>
<th>Runs</th>
</tr>
<?php foreach ($rows as $row): array_map('htmlentities', $row); ?>
<tr>
<td><?php echo implode('</td><td>', $row); ?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
<?php endif;?>
<div id="teamSelectorDiv">
<div id=buttonDiv>
<button id='restart' class="btn success" onclick="redirectTo('index.php')"> Return to main page </button>
</div>
</div>
<div id="footerDiv">
<b>2023 Winners</b>: <b style="color: gold;">1. Bentown Tippers</b>, <b style="color: silver;">2T. Dayville Daytrippers</b>, <b style="color: silver;">2T. Megtown Senders</b>
</div>
</div>
</body>
</html>