Hi,
I am trying to display results from a MySQL database, in a block.
Basically, I am trying to achieve:
- all the same brand to display in line with each other.
- Then this to be repeated for as however many brands their are.
However,
Each brand has X products, all these products need to be displayed under the brand heading.
I have tried to do it, however I am getting this error and am really stumped on what to do, or even if I have done this right.
Code below...
$sql = 'SELECT * FROM brand';
$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 brand = '.$row['brand'].'';
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[coda]</div></li>
<li><div class="productSmRRP">RRP: $$info[cost]</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);
Im not sure if I need to group this together somehow, or????
If anyone can help, I would really appreciate it.
Cheers,
QWaz