I have a for each loop like this
$sn_count = 1;
$prodfilter = "";
foreach($prods as $prod){
$prodfilter .= "<div class=\"product\">".$prod['product'][1]."</div>";
$sn_count++;
}
echo $prodfilter;
Now my problem my "product" class displaying border even if the $prod['product'][1]
not available. So i would like to test it using if statement.
If (product value available) {
$prodfilter .= "<div class=\"product\">".$prod['product'][1]."</div>";
}
I tried like this.
if(!empty($prod['product'][1])) {
$prodfilter .= "<div class=\"product\">".$prod['product'][1]."</div>";
}
But its not working.