fai la connessione al DATABASE...
poi

$qry="SELECT SUM(valore) as TOTALE from tabella where id_tabella=1;
$risultato=mysql_query($qry);
$riga=mysql_fetch_arrau($risultato);


echo "TOTALE=".$riga['TOTALE'];


E' quello che ti serve?