Gebruik een alias en bestel op voor de juiste telvolgorde
$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 "<tr>
<td>".$rat['name']."</td>
<td>".$rat['my_count']."</td>
</tr>";
}