Yes, my_sum is a function.. has a little more than this, but this is the jist of it:
$conn = mysql_connect(MYSERVER,MYLOGIN,MYPASSWORD);
mysql_select_db(MYDATABASE, $conn);
$sql = "$tmpcon";
$result = mysql_query($sql, $conn);
$row = mysql_fetch_row($result);
@mysql_free_result($result);
@mysql_close($conn);
Connecting is not the problem, getting it to pull the right data and show the multiple summed fields is:\