I need help on a if statement here is what is going on.
I have a value being pulled $paint['product_id']
I need to say if that value is between 81501 - 81599 or 81701 - 81799 say blah
else if that value is between 81001 - 81099 or 81301 - 81399 say blah2
else if 86501 - 86599 or 86001 - 86099 or 85001 - 85099 say blah3
and say nothing if it does not apply.
What id did try
<? if ($paint['product_id'] >= 81501 && $x <= 81599 || $paint['product_id'] >= 81701 && $x <= 81799):?>
blah
<? elseif ($paint['product_id'] >= 81001 && $x <= 81099 || $paint['product_id'] >= 81301 && $x <= 81399):?>
blah2
<? elseif ($paint['product_id'] >= 86501 && $x <= 86599 || $paint['product_id'] >= 86001 && $x <= 86099 || $paint['product_id'] >= 85001 && $x <= 85099):?>
blah3
<? endif;?>
The problem I am having is "blah" is showing up on items in the blah3 category.
Hope that makes sense and thanks in advance for any help!
Replace $x
with $paint['product_id']
.
You should group them with brackets:
if( ($x > 10 && $x < 20) || ($x > 40 && $x < 50) ) { ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With