elpaisa Posted July 14, 2008 Share Posted July 14, 2008 Hi! Basically what i need to do is sum all the values from a single field in a database!, can somebody point me to the right direction. Tnx!. Link to comment https://forums.phpfreaks.com/topic/114629-solved-calculating-subtotal-price-value-from-record-in-database/ Share on other sites More sharing options...
JasonLewis Posted July 14, 2008 Share Posted July 14, 2008 Well, my MySQL isn't the best. But try this out for size: $query = mysql_query("SELECT SUM(`price`) FROM `table` WHERE `userID`='{$id}'"); Good luck. Link to comment https://forums.phpfreaks.com/topic/114629-solved-calculating-subtotal-price-value-from-record-in-database/#findComment-589345 Share on other sites More sharing options...
elpaisa Posted July 14, 2008 Author Share Posted July 14, 2008 is there some way to do it by php? Link to comment https://forums.phpfreaks.com/topic/114629-solved-calculating-subtotal-price-value-from-record-in-database/#findComment-589353 Share on other sites More sharing options...
elpaisa Posted July 14, 2008 Author Share Posted July 14, 2008 SOLVED! THANKS. Link to comment https://forums.phpfreaks.com/topic/114629-solved-calculating-subtotal-price-value-from-record-in-database/#findComment-589359 Share on other sites More sharing options...
JasonLewis Posted July 14, 2008 Share Posted July 14, 2008 What do you mean, it is... $query = mysql_query("SELECT SUM(`price`) FROM `table` WHERE `userID`='{$id}'"); $subtotal = mysql_result($query,0); echo "Subtotal: $".$subtotal; Okay... No drama's. Lol. Link to comment https://forums.phpfreaks.com/topic/114629-solved-calculating-subtotal-price-value-from-record-in-database/#findComment-589360 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.