Save sqlsummary.php as sqlgroupby.php. Change the whole block of PHP to this:
$sqlResult=mysqli_query($dbconnection, "SELECT userName, count(itemEaten) AS numberOfFruit FROM item GROUP BY userName;");
while ($sqlRow=mysqli_fetch_array($sqlResult)) {
$userName=$sqlRow["userName"];
$count=$sqlRow["numberOfFruit"];
echo "<p>$userName ate $count";
}
Try it. The query may look confusing. You are selecting two fields of data. One is a real field (the name). The other is the calculated field (how many items the user ate). You are grouping the data based on the username. So it will only show each username once. Therefore you get two rows. Each has the user name and the count of fruit items eaten for each name.