That just gives me all the records, doesn't it?. What I want is the top N users (where N=5 or N=10, for example).
So I'm getting all the records, and creating an associative array, where the key is the user name, and the value is the count of the records with that user name. Then sorting that descending, and printing the first N array values and their keys.
For example, if I had records:
Fred
Gene
Sparhawk
Gene
Sharhawk
Gene
I'd end up with:
$upcount = array("Fred" => 1, "Gene" => 3, "Sparhawk" => 2, );
I'd then sort that array descending by values, and end up with:
$upcount = array("Gene" => 3, "Sparhawk" => 2, "Fred" => 1);
Then I could print the top 2 entries or whatever.
However, what I'm ending up with is something like:
$upcount = array(0 => 3, 1 => 2, 2 => 1)
i.e., the keys are numbers instead of the user names.
I'm not sure if I'm explaining this correctly or not. It's clear in my mind :-)
thanks,
gene