I have a problem, I can't make my script count each result but I can count the total result. The table I am using is "wn_synset" and the column is "ss_type" but it should be matched in the matched query in the column "word" which is also in the same table. My code for counting the total result is this: //Parts of Speech, contains in ss_type for echo $part_speech = array("n"=>"n.","v"=>"verb", "r"=>"adv./adj.", "a"=>"adj.", "s"=>"adj."); $counting = mysql_query('SELECT count(ss_type) FROM wn_synset WHERE word="'.str_replace(' ', '_', $word).'"'); $total = mysql_fetch_array($counting); echo "Total: $total[0]"; PHP: Now, how can I make it also count the result found if the word matched has "n", "v", "r"...? and not to echo the count that haven't matched in ss_type column? Sorry for the a lot of questions in PHP.