1
Is there any way to make a condition to demonstrate data only if the status
be as aprovado
in the database?
Mysql:
Nome ProdValor Data Status
Goku 250,00 15/04/2015 Aprovado
Goku 250,00 15/04/2015 Pendente
Goku 250,00 15/04/2015 Cancelado
PHP
$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;
I tested your example and it worked perfectly, thank you. The field I’m using is varchar.
– the flash
I’ve marked it as more correct, thank you.
– the flash