Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- echo "<meta http-equiv='refresh' content='600' charset='UTF-8' />";
- date_default_timezone_set('Europe/Sofia');
- $servername = "localhost";
- $username = "arduino";
- $password = "testtest";
- $dbname = "arduino";
- // Create connection
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT number, date, dht1_t, dht1_h, dht2_t, dht2_h FROM temperature";
- $result = $conn->query($sql);
- if ($result->num_rows > 0) {
- // output data of each row
- while($row = $result->fetch_assoc()) {
- //$date_array[]=$row['date'];
- //$temp1_array[]=$row['dht1_t'];
- //$temp2_array[]=$row['dht2_t'];
- echo "<br> N: ". $row["number"]. " - Date: ". gmdate("Y-m-d H:i:s", $row["date"]+7200). " | Temp: " . $row["dht1_t"] . " - Humidity: " . $row["dht1_h"].
- " | Temp 2: " . $row["dht2_t"]. " - Humidity: ". $row["dht2_h"]. "<br>";
- }
- print_r($date_array);
- print_r($temp1_array);
- print_r($temp2_array);
- } else {
- echo "0 results";
- }
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement