Reputation: 5
I need to check if status A and B is blank or 0, but my blank doesnt work, Any suggestions?
$sta = db2_result($queryexe, 'STATUSA');
$stb = db2_result($queryexe, 'STATUSB');
if ($sta=="0" OR $sta=="" AND $stb=="0" OR $stb=="")
Upvotes: 0
Views: 37
Reputation: 3031
You should use the empty function which consider 0, "0", null... as empty values :
if (empty($sta) && empty($stb)) {
If you want to stick with your logic, consider to separate the if statements in two parts :
if (
($sta=="0" OR $sta=="")
AND
($stb=="0" OR $stb=="")
) {
Upvotes: 1
Reputation: 4220
if (($sta=="0" OR $sta=="") AND ($stb=="0" OR $stb==""))
2+3*4 is not the same as (2+3)*4. The same is with OR and AND
Upvotes: 0