3
I’m trying to demonstrate records from the last 3 days, but it should be subtracted two days and only demonstrate the value of a single day before the 2 days, currently I have the following code that is demonstrated the value of the last month subtracting the current month.
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;
Please add to the question an example of feedback that you expect. I confess that I found the question very confusing.
– Thiago Lunardi
This sentence is not at all clear: "[...] but must be subtracted two days and only demonstrate the value of a single day before the 2 days [...]". Try to improve the explanation, or someone will hardly be able to help you.
– Luiz Vieira