Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help with coding - If Products_id equal 5 then ..


Guest

Recommended Posts

Posted

<?php if (($product_info['products_id']) == 5) { 
echo 'hello';
}
?>

 

I have the above code and it works fine. Basically if the products_id equal 5 then word Hello is printed.

 

What I require is the coding for:

 

If the Products_id is greater than 4 but less than 8 print hello

 

I have tried these two example but both fail.

 

<?php if (($product_info['products_id']) == 4,5,6,7,8) { 
echo 'hello';
}
?>

 

<?php if (($product_info['products_id']) > 4 <8) { 
echo 'hello';
}
?>

 

Anyone help here?

Posted
<?
 if ($product_info['products_id'] > 4 && $product_info['products_id'] < 8) {
echo 'hello';
 }
?>

Please use the forums for support! I am happy to help you here, but I am unable to offer free technical support over instant messenger or e-mail.

Posted

Google is an amazing thing, solved it:

 

<?php if (($product_info['products_id']) >= 5 && ($product_info['products_id']) <= 8) { 
echo 'hello';
}
?>

Posted

Argh posted at the same time, but thank you for you help.

 

Stuart

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...