SUM总结果为while循环(已结算)

时间:2015-10-02 08:40:21

标签: php sql select

我需要在while循环中计算一个总数。我尝试了各种解决方案,但我仍然没有得到任何结果。你们可以向我提出任何想法吗?

问题是,一旦我得到'$ section_total',我想总结section_total并输出$ totalsum中的输出。我也累了$ toalsum + = $ section_total;

这是我的代码:

DELETE FROM

2 个答案:

答案 0 :(得分:1)

 $section_total = round($subtotal*$final_mark);
 //After above line in your existing code. Write code as below.
 $totalsum += $section_total;

答案 1 :(得分:0)

在你的while循环中添加$totalsum, 把它放在$j++;

之后

$totalsum = $totalsum + $whateverYouWantToAdd;