$query = "SELECT type, COUNT(name) FROM products GROUP BY type"; 
    
$result = mysql_query($query) or die(mysql_error());
// Print out result
while($row = mysql_fetch_array($result)){
   echo "There are ". $row['COUNT(name)'] ." ". $row['type'] ." items.";
   echo "<br />";