-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathframes.php
73 lines (58 loc) · 2.03 KB
/
frames.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
<!DOCTYPE html>
<html>
<head>
<title>Sparx99 - Energy-Meter</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
<style>
.center {
margin: auto;
width: 50%;
padding: 10px;
}
</style>
</head>
<body>
<br>
<div class="center">
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>DateTime</th>
<th>Active Energy</th>
<th>Passive Energy</th>
</tr>
</thead>
<tbody>
<?php
if (isset($_GET["ind"])) {
$server = "localhost"; // mysql server address
$user = ""; // mysql username
$passwd = ""; // mysql password
$db = "sparx99_energy-meter"; // database name
$connection = new mysqli($server, $user, $passwd, $db);
if ($connection -> connect_error) {
die();
}
$table = $_GET["ind"];
$sql = "SELECT * FROM $table ORDER BY ID DESC";
$result = $connection -> query($sql);
if (!$result) {
die();
}
while ($row = $result -> fetch_assoc()) {
echo "<tr>";
echo "<td>" . $row["ID"] . "</td>";
echo "<td>" . $row["DateTime"] . "</td>";
echo "<td>" . $row["ActiveEnergy"] . "</td>";
echo "<td>" . $row["PassiveEnergy"] . "</td>";
echo "</tr>";
}
}
?>
</tbody>
</table>
</div>
</body>
</html>