您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

57 行
1.8 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. $username = "u488983909_neonflake";
  14. $password = "Tony@1234";
  15. $dbname = "u488983909_neonflake";
  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>S.No</th>
  26. <th>Temperature</thh>
  27. <th>Luminosity</th>
  28. <th>pH</th>
  29. <th>Time</th>
  30. </tr>';
  31. if ($result = $conn->query($sql)) {
  32. while ($row = $result->fetch_assoc()) {
  33. $row_s.no = $row["S.No"];
  34. $row_temp = $row["Temperature"];
  35. $row_lumi = $row["Luminosity"];
  36. $row_ph = $row["pH"];
  37. $row_reading_time = $row["Time"];
  38. echo '<tr>
  39. <td>' . $row_s.no . '</td>
  40. <td>' . $row_temp . '</td>
  41. <td>' . $row_lumi . '</td>
  42. <td>' . $row_ph . '</td>
  43. <td>' . $row_reading_time . '</td>
  44. </tr>';
  45. }
  46. $result->free();
  47. }
  48. $conn->close();
  49. </table>
  50. ?>
  51. </body>