Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

76 linhas
1.7 KiB

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="refresh" content="5" >
  5. <link rel="stylesheet" type="text/css" href="style.css" media="screen"/>
  6. <script src="https://cdn.tailwindcss.com"></script>
  7. <title> Sensor Data </title>
  8. </head>
  9. <body>
  10. <h1>SENSOR DATA</h1>
  11. <?php
  12. $servername = "localhost";
  13. $user = "root";
  14. $password = "";
  15. $dbname = "datasensor";
  16. // Create connection
  17. $conn = new mysqli($servername, $user,$password, $dbname);
  18. // Check connection
  19. if ($conn->connect_error) {
  20. die("Connection failed: " . $conn->connect_error);
  21. }
  22. $sql = "SELECT id, Tank1, Tank2, rainwater, Turbidity,pH_sensor, reading_time FROM sensordata ORDER BY id DESC"; /*select items to display from the sensordata table in the data base*/
  23. echo '<table cellspacing="5" cellpadding="5">
  24. <tr>
  25. <th>Storage Tank</th>
  26. <th>PotashAlum Tank</thh>
  27. <th>Turbidity</th>
  28. <th>pH_sensor</th>
  29. <th>Data Time</th>
  30. </tr>';
  31. if ($result = $conn->query($sql)) {
  32. while ($row = $result->fetch_assoc()) {
  33. $row_Tank1 = $row["Tank1"];
  34. $row_Tank2 = $row["Tank2"];
  35. $row_Turbidity = $row["Turbidity"];
  36. $row_pH_sensor = $row["pH_sensor"];
  37. $row_reading_time = $row["reading_time"];
  38. echo '<tr>
  39. <td>' . $row_Tank1 . '</td>
  40. <td>' . $row_Tank2 . '</td>
  41. <td>' . $row_Turbidity . '</td>
  42. <td>' . $row_pH_sensor . '</td>
  43. <td>' . $row_reading_time . '</td>
  44. </tr>';
  45. }
  46. $result->free();
  47. }
  48. $conn->close();
  49. ?>
  50. </table>
  51. </div>
  52. </body>
  53. </html>
  54. </body>
  55. </html>