Save sqldistinct.php as sqlsummary.php.
Replace the middle block of code with this:
$sqlResult=mysqli_query($dbconnection, "SELECT COUNT(userName) AS numberOfUsers FROM item;") or die("query to get number of users failed with this error: ".mysqli_error($dbconnection)); $sqlRow=mysqli_fetch_array($sqlResult); $count=$sqlRow["numberOfUsers"]; echo "<p>There are $count</p>";
Try it. The text after the AS is like a fake field name to use later in the code to get the data. This counts the number of records but you could just count the number of distinct users. Replace the query with this to count the number of different users:
SELECT COUNT(DISTINCT userName) AS numberOfUsers FROM item;
If the data had been numeric you can also use SUM instead of COUNT. You then add the numbers together and just display the total.
If you want to try this create a table with a numeric field and total it by adapting the above code for the new page.