DrTrans Posted April 14, 2010 Share Posted April 14, 2010 $query = "SELECT SUM(Amount) FROM `gldetail` WHERE Property_ID = '$propertyid'"; $result = mysql_query($query); $sum = mysql_result($result,0); echo"$sum"; Basically in my gldetail table there are 5 fields " Amount, Property_ID, Lease_ID, " I want to take all the amounts and get them into a whole figure by the "Property" Link to comment https://forums.phpfreaks.com/topic/198510-php-sum/ Share on other sites More sharing options...
Deoctor Posted April 14, 2010 Share Posted April 14, 2010 ok so what is the problem Link to comment https://forums.phpfreaks.com/topic/198510-php-sum/#findComment-1041630 Share on other sites More sharing options...
DrTrans Posted April 14, 2010 Author Share Posted April 14, 2010 Its giving me a "0" result Link to comment https://forums.phpfreaks.com/topic/198510-php-sum/#findComment-1041633 Share on other sites More sharing options...
Deoctor Posted April 14, 2010 Share Posted April 14, 2010 first echo $query and run the same in mysql to see what values u are getting Link to comment https://forums.phpfreaks.com/topic/198510-php-sum/#findComment-1041642 Share on other sites More sharing options...
litebearer Posted April 14, 2010 Share Posted April 14, 2010 try looking here ... http://www.codingforums.com/showthread.php?t=136155 Link to comment https://forums.phpfreaks.com/topic/198510-php-sum/#findComment-1041655 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.