I need some help with my SQL queries from php.
Here is my PHP code:
$sql = "SELECT * FROM datab WHERE (`datestamp` BETWEEN '$date' AND '$date') AND (`timestamp` BETWEEN '08:00:01' AND '20:00:00')";
$result = $conn->query($sql);
while($list = mysqli_fetch_array($result))
{
//echo "$list[0]</br>";
echo "$list[1]</br>"; //this is the column from MySQL corresponding to temperatures
//echo "$list[2]</br>"; //this is the column from MySQL corresponding to other entries (humidity)
//echo "$list[3]</br>";
// echo "$list[4]</br>";
// echo "$list[5]</br>";
//echo "$list[6]</br>";
// echo "$list[7]</br>";
}
So, I need to access my each temperature like an array or a list element and I don't know how to do it. I think the solution is to add each $list[1] element into another array inside that while.
Basicaly I want to access the element like temp[2] (or smth like that) to be the second element from the printed $list[1].
Can anyone help me?