connect_error) { die("Connection failed: " . $conn->connect_error); } $sql = "SELECT id, sensor, location, value1, value2, value3, reading_time FROM SensorData ORDER BY id DESC"; echo '
ID
Sensor
Location
Value 1
Value 2
Value 3
Timestamp
'; if ($result = $conn->query($sql)) { while ($row = $result->fetch_assoc()) { $row_id = $row["id"]; $row_sensor = $row["sensor"]; $row_location = $row["location"]; $row_value1 = $row["value1"]; $row_value2 = $row["value2"]; $row_value3 = $row["value3"]; $row_reading_time = $row["reading_time"]; // Uncomment to set timezone to - 1 hour (you can change 1 to any number) //$row_reading_time = date("Y-m-d H:i:s", strtotime("$row_reading_time - 1 hours")); // Uncomment to set timezone to + 4 hours (you can change 4 to any number) //$row_reading_time = date("Y-m-d H:i:s", strtotime("$row_reading_time + 4 hours")); echo '
' . $row_id . '
' . $row_sensor . '
' . $row_location . '
' . $row_value1 . '
' . $row_value2 . '
' . $row_value3 . '
' . $row_reading_time . '
'; } $result->free(); } $conn->close(); ?>