So you’re saying that the code in the if
statement (if
is not a loop, by the way) is not executed? Then it’s probably because the condition it checks is false.
The reason is probably in the code above the loop. This condition is wrong:
if($select == 'Today' OR 'today') {
$select = $today;
}
It should (probably) be:
if ($select == 'Today' or $select == 'today') {
$select = $today;
}
Same goes for the other similar conditions in that piece of code. This error causes $select
to have a different value than expected. This is by the way something you can have easily discovered using some poor man’s debugging, ie, by var_dump
ing the values you compare in your if
condition.
1
solved If statement multiple conditions checking [closed]