$sql1="select * from catalog where genid='$genid' group by genid";
$result1 = mysql_db_query($database,$sql1);
while($row1 = mysql_fetch_array($result1))
{
echo "$row1[genid]";
$sql1="select * from catalog where genid='$genid' group by genid";
$result1 = mysql_db_query($database,$sql1);
while($row1 = mysql_fetch_array($result1))
{
$SQL = mysql_num_rows(mysql_query("SELECT * FROM catalog where genid='$row1[genid]' group by brand desc"));