0
I am having difficulty subtracting fields from the same column (measurement), I have date, time and measurement in a table called reading.
I want it to stay that way:
data, hora, medicao, consumo
06/09, 10:00, 200, 0
07/09, 10:00, 210, 10
08/09, 10:00, 235, 25
09/09, 10:00, 290, 55
Always taking the medication of the day and subtract with the previous day and inform the result, the field consumption does not exist in the bank.
That has to be inside the while.
$sqlbuscar = "SELECT data, hora, medicao FROM medicoes";
$result = mysqli_query($conexao, $sql);
while ($linha = mysqli_fetch_array($result)) {
$linha["0"];
$linha["1"];
$linha["2"];
$consumo;
}