I'm trying to figure out how to display the username column in the while loop below and also with counting how many hits each user had.
$query = "SELECT company, COUNT(company) FROM tableName GROUP BY company";
$result = mysql_query($query) or die(mysql_error());
// Print out result
while($row = mysql_fetch_array($result)){
echo "There are ". $row['COUNT(company)'] ."
". $row['company'] ." hits total so far";
echo "<br />";
}
For example
There are 3 facebook hits total so far - user1(1 total), user2(1 total), user3(1 total)
There are 2 google hits total - user1(2 total)
There are 6 mircosoft hits total - user3(1 total)
There are 0 dropbox hits total
I appreciate any help you can provide!
Tim