$result=mysql_query("SELECT breed FROM animals WHERE animals.breed = animals.breed ORDER BY breed")or die( "Error! Could not select the database: " . mysql_error() ); that query doesnt make sense where animals.breed=animals.breed will ALWAYS Be true. and you dont even need the animals. because your only selecting from one database heres a logical way of doing what you need [code]<table class="text1" width="100%" border="0" cellpadding="2" cellspacing="0"> <? $result=mysql_query("SELECT breed, count(breed) as num FROM animals ORDER BY breed")or die( "Error! Could not select the database: " . mysql_error() ); while ($category = mysql_fetch_array($result)) { echo '<tr> <td width="11"><img src="images/down_arrow.jpg" width="10" height="10"></td> <td width="100%"><a href="'.$path.$category['breed'].'.php">'.$category['breed'].'</a> <a href="'.$path.$category['breed'].'.php"> ( '.$category['num'].')'; }[/code] thats not tested, but it should work... try that