Personal I have the following code below and would like it to return the sum of the values separated by the said release month in PHP, since it is returning the current month.
Example:
DATA VALOR 21/01/2018 200.00 23/02/2018 200.00 25/01/2018 200.00
JANUARY: 400.00 FEBRUARY: 200.00
And so on. Someone who can help me?
<?php
$conn = mysqli_connect('localhost','root','root','sistema');
$resultado = mysqli_query($conn, "SELECT sum(total) FROM pedidos GROUP BY YEAR(post_at), MONTH(post_at) ;" );
$linhas = mysqli_num_rows($resultado);
while($linhas = mysqli_fetch_array($resultado)){
echo date("m ") . 'R$: ' . $linhas[ 'sum(total)'] .'<br/>';
?>
<?php
}
?>