mysql_connect($hostname, $username, $password);
mysql_select_db($db);
$sql = "select sum(column) from table";
$q = mysql_query($sql);
$row = mysql_fetch_array($q);
echo 'Sum: ' . $row[0];
Vervang variabelenamen en tabel-/kolomnamen indien nodig.