From the table image below:
Is there any ways that I used nodeID 101 as my indicator. Then I want to retrieve battery value of Node102 which is lower than the battery value of NodeID101... Same goes to node103, it will also compare with node101 whereby if its battery value lower than node101, result is displayed.
Thanks for your guides!
<?php
$username="root";
$password="";
$database="testing";
mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die("Unable to select database");
$query = "SELECT * FROM monitoring WHERE Battery < 2.7";
$result = mysql_query($query);
echo "<b><center>Database Output</center></b><br><br>";
echo "<table border='1'>
<tr>
<th>PC_Timestamp </th>
<th>NodeID </th>
<th>PacketID </th>
<th>RSSI </th>
<th>Node_Timestamp </th>
<th>Temperature </th>
<th>Battery </th>
</tr>";
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['PC_Timestamp'] . "</td>";
echo "<td>" . $row['NodeID'] . "</td>";
echo "<td>" . $row['PacketID'] . "</td>";
echo "<td>" . $row['RSSI'] . "</td>";
echo "<td>" . $row['Node_Timestamp'] . "</td>";
echo "<td>" . $row['Temperature'] . "</td>";
echo "<td>" . $row['Battery'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close();
?>