I have this query:
SELECT date, sum(money) as total
FROM gasto
GROUP BY date;
The table in question has two fields: date (where the input is a specific day), and money (an integer).
To print out the sums, for each day, I do this:
$resultado=mysqli_query($conectar,$consulta); //this is to get the result
foreach ($resultado as $key => $value) {
echo $key.' - '.$value['total'].'<br>';
This results in:
0 - 20
1 - 45
2 - 12
etc.
My question is, how do I print out each date right before the aumont?