this is what i have:
<?php if($row['id']!="9") echo "style=\"display:none\""; ?>
simple enough, it should place style="dsplay:none" when ‘id’ is anything but 9. this does the job well, but i wanted to include ‘id’ 8, 12 and 13 aswell. looked simple enough, just added the logical or like this:
<?php if($row['id']!="8||9||12||13") echo "style=\"display:none\""; ?>
but it does not function anymore, so it places style="dsplay:none" all the time.
i wanted to go the other way around and did this
<?php if($row['id']=="4||5||6||11") echo "style=\"display:none\""; ?>
but this time around style="dsplay:none"was never placed.
this brought me to the conclusion that there must be something wrong with the logical or. but what is it? please let me know, thanks!
You want:
because the current way you are doing it is comparing the value of $
row['id']to the string value"8||9||12||13".Or you can do something like:
to condense the condition.