-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtime.php
More file actions
executable file
·30 lines (25 loc) · 767 Bytes
/
time.php
File metadata and controls
executable file
·30 lines (25 loc) · 767 Bytes
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
<?php
$servername = "localhost";
$username = "datalogger";
$password = "datalogger";
$dbname = "datalogger";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
#$phpdate = strtotime( $mysqldate );
#$mysqldate = date( 'Y-m-d H:i:s', $phpdate );
$sql = "SELECT date_time, sensor, temperature, humidity FROM datalogger ORDER BY date_time DESC LIMIT 1";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
// output data of each row
while($row = mysqli_fetch_assoc($result)) {
echo "<b>". "LAST UPDATE: " . $row["date_time"]. "</b>";
}
} else {
echo "0 results";
}
mysqli_close($conn);
?>