Advertisement
Guest User

Untitled

a guest
May 21st, 2017
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.73 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title>Pogodynka</title>
  4. <meta http-equiv="refresh" content="90">
  5. </head>
  6. <body>
  7. <?php
  8. $servername = "localhost";
  9. $username = "root";
  10. $password = "admin123";
  11. $dbname = "temp";
  12.  
  13. // Create connection
  14. $conn = new mysqli($servername, $username, $password, $dbname);
  15.  
  16. // Check connection
  17. if ($conn->connect_error) {
  18. die("Connection failed: " . $conn->connect_error);
  19. }
  20. else
  21. {
  22. $sql = "SELECT * FROM temp ORDER BY ID DESC LIMIT 1";
  23. $result = $conn->query($sql);
  24. $row = $result->fetch_assoc();
  25. echo "<table cellpadding='0' cellspacing='0' border=1><tr><td bgcolor='#00FF00'><a href='/templog'>LOG</a></td></tr></table>";
  26. echo "<div style='width: 600px; margin: auto'>";
  27. echo "<table WIDTH=520 border=1 cellspacing='0' style='font-size:90px'>";
  28. echo "<tr>";
  29. echo "<th colspan=2>Temperatura</th>";
  30. echo "</tr>";
  31. echo "<tr>";
  32. echo "<td><center>IN</center></td>";
  33. echo "<td><center>OUT</center></td>";
  34. echo "</tr>";
  35. echo "<td><center>".$row["Temp_in"]." °C"."</center></td>";
  36. echo "<td><center>".$row["Temp_out"]." °C"."</center></td>";
  37. echo "</table><br>";
  38.  
  39. echo "<table WIDTH=520 border=1 cellspacing='0' style='font-size:90px'>";
  40. echo "<tr>";
  41. echo "<th colspan=2>Wilgotność</th>";
  42. echo "</tr>";
  43. echo "<tr>";
  44. echo "<td><center>IN</center></td>";
  45. echo "<td><center>OUT</center></td>";
  46. echo "</tr>";
  47. echo "<td><center>".$row["Wil_in"]." %"."</center></td>";
  48. echo "<td><center>".$row["Wil_out"]." %"."</center></td>";
  49. echo "</table>";
  50. echo "</div>";
  51. //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"]."%";
  52. $conn->close();
  53. }
  54. ?>
  55. </body>
  56. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement