-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.php
61 lines (54 loc) · 1.79 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
55
56
57
58
59
60
61
<!--
Made by Nick Parks
Simple and basic PHP file without the laravel framework to display data from WarMod results
Time: 1:00PM 8/14/15
-->
<?php
include 'config.php';
$connection = new mysqli($server, $username, $password, $database);
if ($connection->connect_error) {
die('Connection failed: ' . $connection->connect_error);
}
$query = 'SELECT * FROM `results`';
$result = $connection->query($query);
?>
<html>
<head>
<title>WarMod results</title>
<!-- Bootstrap for quick styling -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body style="padding-top: 25px">
<div class="container">
<table class="table table-bordered table-hover" style="text-align: center">
<tr style="background-color: lightgrey; font-weight: bold">
<td>ID</td>
<td>Map</td>
<td>Team 1</td>
<td>Team 2</td>
<td>Team 1 score</td>
<td>Team 2 score</td>
</tr>
<?php
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row['match_id'] . "</td>";
echo "<td>" . $row['map'] . "</td>";
echo "<td>" . $row['t_name'] . "</td>";
echo "<td>" . $row['ct_name'] . "</td>";
echo "<td>" . $row['t_overall_score'] . "</td>";
echo "<td>" . $row['ct_overall_score'] . "</td>";
echo "</tr>";
}
} else {
echo "<tr>";
echo "<td colspan='6'>No results to display!</td>";
echo "</tr>";
}
?>
</table>
</div>
</body>
</html>