|
- <!DOCTYPE html>
- <html>
- <head>
- <meta http-equiv="refresh" content="5" >
- <link rel="stylesheet" type="text/css" href="style.css" media="screen"/>
- <script src="https://cdn.tailwindcss.com"></script>
- <title> Sensor Data </title>
- </head>
-
- <body>
- <h1>SENSOR DATA</h1>
- <?php
- $servername = "localhost";
- $username = "u488983909_neonflake";
- $password = "Tony@1234";
- $dbname = "u488983909_neonflake";
-
- // Create connection
- $conn = new mysqli($servername, $user,$password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
-
- $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*/
- echo '<table cellspacing="5" cellpadding="5">
- <tr>
- <th>S.No</th>
- <th>Temperature</thh>
- <th>Luminosity</th>
- <th>pH</th>
- <th>Time</th>
- </tr>';
-
- if ($result = $conn->query($sql)) {
- while ($row = $result->fetch_assoc()) {
-
- $row_s.no = $row["S.No"];
- $row_temp = $row["Temperature"];
- $row_lumi = $row["Luminosity"];
- $row_ph = $row["pH"];
- $row_reading_time = $row["Time"];
-
- echo '<tr>
- <td>' . $row_s.no . '</td>
- <td>' . $row_temp . '</td>
- <td>' . $row_lumi . '</td>
- <td>' . $row_ph . '</td>
- <td>' . $row_reading_time . '</td>
- </tr>';
- }
- $result->free();
- }
- $conn->close();
- </table>
- ?>
- </body>
|