Thanks for the debug advice - I will start using my_sql_error First I got this error: Mixing of GROUP columns (MIN(),MAX(),COUNT()...) with no GROUP columns is illegal if there is no GROUP BY clause So the correct code ended up: $sql = "SELECT COUNT(bandid), genre FROM bands, genre GROUP BY genre"; $result=mysql_query($sql) or die(mysql_error()); $num=mysql_fetch_row($result); echo $num[0]; while ($gen=mysql_fetch_row($result)) { echo $gen[1]; } Thanks guys --------------------------------- Do you Yahoo!? Protect your identity with Yahoo! Mail AddressGuard