0
I have a php page that needs to do a query in 3 fields in Mysql Database.
Campo Aprovado
Campo Reprovado
Campo Resolution
$select = mysql_query("select * from denuncia where (resolution is NOT NULL)
AND status='aprovado' or status='reprovado'");
This Query only returns the Failed field, however I need to return everything with approved status, failed and the Resolution field is not null.
Where am I going wrong?
The error must be in the logical operators' precedence, try:
"select * from denuncia where (resolution is NOT NULL) 
AND (status='aprovado' or status='reprovado)'"
– rdleal
I had already tried this way. Returns this error: Warning: mysql_fetch_assoc(): supplied argument is not a Valid Mysql result Resource in
– user54154
What is passing as an argument for the
mysql_fetch_assoc
?– rdleal
The select variable of this query : while($fetch = mysql_fetch_assoc($select)){
– user54154
Try to run the function
echo mysql_error();
after the line$select = mysql_query("...");
.– rdleal
Syntax error You have an error in your SQL syntax; check the manual that Corresponds to your Mysql server version for the right syntax to use near '' at line 1
– user54154
Sorry, there is a syntax error in the query I suggested, the last quotation marks were outside the parentheses, correcting:
select * from denuncia where (resolution is NOT NULL) AND (status='aprovado' or status='reprovado')
.– rdleal
It worked. Thank you :)
– user54154