I am trying to echo the most common duplicates in a table. I have been able to echo the name of the duplicates but what I\'m looking for is a separate column in the table th
Use an alias and order by for correct count sequence
$interests = "SELECT name, COUNT(*) AS my_count
FROM pageinterests
WHERE pageid = '$id'
GROUP BY name HAVING COUNT(*) > 1
ORDER BY my_count";
.......
for($x = 1; $x <= $rim; $x++){
$rat = mysqli_fetch_assoc($interestresults);
echo "
".$rat['name']."
".$rat['my_count']."
";
}