Browse Source

Update 'index.php'

master
Santhosh Reddy Lotla 2 years ago
parent
commit
bc92faa0e6
1 changed files with 44 additions and 63 deletions
  1. +44
    -63
      index.php

+ 44
- 63
index.php View File

@@ -4,73 +4,54 @@
<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";
$user = "root";
$password = "";
$dbname = "datasensor";

// 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>Storage Tank</th>
<th>PotashAlum Tank</thh>
<th>Turbidity</th>
<th>pH_sensor</th>
<th>Data Time</th>
</tr>';
if ($result = $conn->query($sql)) {
while ($row = $result->fetch_assoc()) {
$row_Tank1 = $row["Tank1"];
$row_Tank2 = $row["Tank2"];
$row_Turbidity = $row["Turbidity"];
$row_pH_sensor = $row["pH_sensor"];
$row_reading_time = $row["reading_time"];

echo '<tr>
<td>' . $row_Tank1 . '</td>
<td>' . $row_Tank2 . '</td>
<td>' . $row_Turbidity . '</td>
<td>' . $row_pH_sensor . '</td>
<td>' . $row_reading_time . '</td>
</tr>';
<?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);
}
$result->free();
}

$conn->close();
?>
</table>


</div>

</body>
</html>

</body>
</html>
$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>

Loading…
Cancel
Save