Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title>Pogodynka</title>
- <meta http-equiv="refresh" content="90">
- </head>
- <body>
- <?php
- $servername = "localhost";
- $username = "root";
- $password = "admin123";
- $dbname = "temp";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- else
- {
- $sql = "SELECT * FROM temp ORDER BY ID DESC LIMIT 1";
- $result = $conn->query($sql);
- $row = $result->fetch_assoc();
- echo "<table cellpadding='0' cellspacing='0' border=1><tr><td bgcolor='#00FF00'><a href='/templog'>LOG</a></td></tr></table>";
- echo "<div style='width: 600px; margin: auto'>";
- echo "<table WIDTH=520 border=1 cellspacing='0' style='font-size:90px'>";
- echo "<tr>";
- echo "<th colspan=2>Temperatura</th>";
- echo "</tr>";
- echo "<tr>";
- echo "<td><center>IN</center></td>";
- echo "<td><center>OUT</center></td>";
- echo "</tr>";
- echo "<td><center>".$row["Temp_in"]." °C"."</center></td>";
- echo "<td><center>".$row["Temp_out"]." °C"."</center></td>";
- echo "</table><br>";
- echo "<table WIDTH=520 border=1 cellspacing='0' style='font-size:90px'>";
- echo "<tr>";
- echo "<th colspan=2>Wilgotność</th>";
- echo "</tr>";
- echo "<tr>";
- echo "<td><center>IN</center></td>";
- echo "<td><center>OUT</center></td>";
- echo "</tr>";
- echo "<td><center>".$row["Wil_in"]." %"."</center></td>";
- echo "<td><center>".$row["Wil_out"]." %"."</center></td>";
- echo "</table>";
- echo "</div>";
- //echo "Temperatura wewnątrz: ".$row["Temp_in"]."°C"."<br> Wilgotność wewnątrz: ".$row["Wil_in"]."%"."<br> Temperatura na zewnątrz: ".$row["Temp_out"]."°C"."<br>Wilgotność na zewnątrz: ".$row["Wil_out"]."%";
- $conn->close();
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement