Luther_Caloring Posted September 9, 2013 Share Posted September 9, 2013 Quote 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']; } Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.