Code: Select all
$count = 0;
$result = mysql_query ("SELECT * FROM manufacturers INNER JOIN products ON manufacturers.id=products.manid GROUP BY manufacturer.id");
while ($row = mysql_fetch_object($result))
{
$count = $count + 1;
echo "<div class='manufacturersbox'><a href='/sell/$row->products.id/'>";
if ($row->manufacturers.image == NULL) { echo "<img src='/images/photounavailable.jpg' width='110px' border='0' />";}
else { echo "<img src='/images/manufacturers/$row->manufacturers.image' border='0' />";}
echo "<br/><div class='searchresultsbox_manufacturer'><a href='/sell/$row->products.id/'>$row->manufacturer</a></div></div>";
}
if ($count == "6" || $count == "12" || $count == "18" || $count == "24" || $count == "30")
{ echo "<div style='clear: both;' /><br/><hr noshade size='1' color='#cccccc' style='width: 950px'/>";}
}I tried it without the GROUP BY, and it just produced all the product NAMES, not just DISTINCT (or Grouped by) manufacturer names.