I'm trying to show records for the last 3 days, but it should be subtracted two days and only demonstrate the value of a single day before the 2 days, I currently have the following code that is demonstrated the value of the last month subtracting the month current.
ProdValor | Data
250,00 | 01/04/15
150,00 | 02/04/15
50,00 | 03/04/15
Code:
$busca = mysql_connect("$local","$usuario","$senha") or die("ERRO AO CONECTAR AO MYSQL, VERIFIQUE COM O ADMINISTRADOR" . mysql_error());
mysql_select_db("$banco") or die("BASE DE DADOS INVÁLIDO");
$pesquisa = mysql_query("SELECT sum(ProdValor) FROM vendas WHERE MONTH(data) = MONTH(DATE_ADD(CURDATE(),INTERVAL -1 MONTH))");
while($sum = mysql_fetch_array($pesquisa)){
$soma2 = $sum['sum(ProdValor)'];
}
echo $soma2;