Luther_Caloring Posted September 9, 2013 Share Posted September 9, 2013 Link to comment https://forums.phpfreaks.com/topic/281996-mysql-help-please-anyone-help-me-with-this/ Share on other sites More sharing options...
Psycho Posted September 9, 2013 Share Posted September 9, 2013 You would best be done in the processing code after you run the query. $query = "SELECT * FROM tbl_payment ORDER BY `Payment No.`"; $result = mysql_query($query) or die (mysql_error()); $total = 0; while($row = mysql_fetch_assoc($result)) { $total += $row['Amount']; } Link to comment https://forums.phpfreaks.com/topic/281996-mysql-help-please-anyone-help-me-with-this/#findComment-1448788 Share on other sites More sharing options...
vinny42 Posted September 9, 2013 Share Posted September 9, 2013 It's called a "rolling total" or "cumulative sum, and MySQL can do that for you. Google for instructions like: http://develop-for-fun.blogspot.nl/2012/06/mysql-select-query-make-cumulative-sum.html Link to comment https://forums.phpfreaks.com/topic/281996-mysql-help-please-anyone-help-me-with-this/#findComment-1448811 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.