$conn = mysql_connect(...);
$sql = "SELECT COUNT(*) AS test, category FROM [database].[table] GROUP BY category";
$result = mysql_query($sql);
while ( $myrow = mysql_fetch_array($result) ) {
echo $myrow['test'] . "x " . $myrow['category'];
}
Say you have this in your table:
[id][category]
1 boats
2 boats
3 houses
4 cars
5 cars
6 cars
7 bikes
8 bikes
The above code will return:
2 boats
1 houses
3 cars
2 bikes
Test is a temp field you created with the count option, category comes from your database.
Actually you tell your query to select all records, group them by category and count those results and name the results of the count "test"
Now you could expand your code by saying if the "test" value is > 1 (greather than) you know it's a duplicate.
hope that helps!