io farei così

Codice PHP:

$my_array
=Array();

$sql1="Select nome,SUM(valore) as somma from tabella GROUP BY nome";
$result1 mysql_query($sql1$db);

while(
$rowt = = mysql_fetch_array($result1))
{
    
$my_array[$row['nome']]=$row['somma'];