Hi,
I am trying to make a list of products with the product heading at the top. and trying to make it dynamic.
I have put a foreach() inside another foreach(), I have all the info in the database, however nothing is displaying. So I am stumped.???.
$sql = "SELECT * FROM products";
$setBrand=array();
foreach ($conn->query($sql) as $row) {
$setBrand[]=<<<END
<div class="brandRowM">
<div class="brandRow">
<div class="brand"><a href="#">$row[brand]</a></div><br />
<div class="productSmPic">
<ul>
END;
$sql = "SELECT * FROM products WHERE top = 1 && brand = '".$row['brand']."'";
$setInfo=array();
foreach ($conn->query($sql) as $info) {
$setInfo[]=<<<END
<li><a href="product.php"><img src="$info[PFN1]" width="100px" height="60px" /></a>
<ul>
<li><div class="productSmName">$info[name]</div></li>
<li><div class="productSmCode">$info[icode]</div></li>
<li><div class="productSmRRP">RRP: $$info[RRP]</div></li>
<li><div class="productSmQRP">Click to see price</div></li>
</ul>
</li>
END;
}
$setInfo=implode("\r\n",$setInfo);
<<<END
</ul>
</div>
</div>
</div>
END;
}
$setBrand=implode("\r\n",$setBrand);
I have been trying to get this to work for (seems like forever), any help would be sooooo appreciated.
Thanks