As for the code being too complicated for a rookie, I can understand that. Maybe these comments, together (and especially) with the manual, will help. Getting familiar with PHP's string and array functions will give you a good foundation for learning PHP.
$query = "select * from amatch";
$result = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($result)) {
// Explode homescoorer into an array of names.
$scoorer_arr = explode(',', $row['homescoorer']);
// Loop through the names.
foreach ($scoorer_arr as $name) {
// Remove any white space from around name.
$name = trim($name);
// If this is the first time the name is found,
// then that key in the totals array is yet to be set.
// Initialize the totals array item with
// the player's name as the index, and start
// the count at one.
if (!isset($totals[$name])) {
$totals[$name] = 1;
} else {
// If the name has been found before,
// increment the array item.
$totals[$name]++;
}
}
}
// Loop through the totals array for display.
foreach ($totals as $key => $val) {
echo $key . ' => ' . $val . '<br />';
}
Edit again: I just saw your last post. 😃