Hi y'all, I'm trying to get a row count of text in a column from a DB. So far I have (and pardon my not so good coding): for ($i=1; $i<500; $i++){ $get_query = mysql_query("SELECT column FROM tbl WHERE id = $i LIMIT 1"); $display_query = mysql_fetch_array($get_query); $query_show = $display_query['column']; $query_count_1 = mysql_query("SELECT column FROM tbl WHERE column LIKE '" . $query_show . "'"); $display_count = mysql_num_rows($query_count_1); if($display_count > 1 && $query_show != ''){ echo $query_show . " - Matches: " . $display_count . "<br />"; } } This almost does what I want in that it gets the text from row1 and searches all other rows and gives a total (if greater than 1) then goes to row2 and searches all the rows and gives a total, etc. However, what I want it to do is give the total and term only once. Close but no cookie. =( Any guidance would be appreciated. Rob
Thats not the way to do it AT ALL. Here try this $get_query = mysql_query("SELECT column, count(column) as myCount GROUP BY column ORDER BY myCount desc"); while($row = mysql_fetch_array($get_query)) { echo $row['column'] . " - Matches: " . $row['myCount'] . "<br />"; } PHP: That is all the code you will need. Amit