Get total from database column based on recordID

I need to get the total of a column in my PHP MySQL based on the recordID

i can get a total of the full column but that’s not what i need

this is my query
[php]$colname_rsProperty = “-1”;
if (isset($_GET[‘recordID’])) {
$colname_rsProperty = $_GET[‘recordID’];
mysql_select_db($database_hostprop, $hostprop);
$query_rsProperty = sprintf(“SELECT * FROM host_editprop, host_editpropUtil, host_editpropUtilComp WHERE host_editprop.prop_id = %s AND host_editpropUtil.prop_id = host_editprop.prop_id AND host_editpropUtilComp.utilID = host_editpropUtil.UtilPropNameID”, GetSQLValueString($colname_rsProperty, “text”));
$rsProperty = mysql_query($query_rsProperty, $hostprop) or die(mysql_error());
$row_rsProperty = mysql_fetch_assoc($rsProperty);
$totalRows_rsProperty = mysql_num_rows($rsProperty);

mysql_select_db($database_hostprop, $hostprop);
$query_rsSum = sprintf(“SELECT SUM(utilityAmount) FROM host_editpropUtil”, GetSQLValueString($colname_rsProperty, “text”));
$rsSum = mysql_query($query_rsSum, $hostprop) or die(mysql_error());
$row_rsSum = mysql_fetch_assoc($rsSum);
$totalRows_rsSum = mysql_num_rows($rsSum);[/php]

this is what i am echoing out

echo $row_rsSum[‘SUM(utilityAmount)’];

Sponsor our Newsletter | Privacy Policy | Terms of Service