如何在PHP表的页脚中生成outosum和average函数

如何在PHP表的页脚中生成outosum和average函数,php,html,html-table,sum,Php,Html,Html Table,Sum,我试图在PHP表的页脚中自动显示一行的总和(也是某些行的平均值) 我不知道该怎么做 我正在使用此查询: $query = "SELECT sector, SUM(usdAmount) AS total, SUM(sumaAbas) as abas FROM DatosSpend WHERE negotiableProcGl='Y' GROUP BY sector 并按如下方式填充表格: while($row = mysqli_fetch_array($result)){

我试图在PHP表的页脚中自动显示一行的总和(也是某些行的平均值)

我不知道该怎么做


我正在使用此查询:

$query =  "SELECT sector, SUM(usdAmount) AS total, SUM(sumaAbas) as abas FROM DatosSpend WHERE negotiableProcGl='Y' GROUP BY sector
并按如下方式填充表格:

while($row = mysqli_fetch_array($result)){
          echo '
          <tr>
            <td class="text-center title-row-table">'.$row["sector"].'</td>
              <td class="text-right table-spend">$'.number_format($row["total"]/"1000",0).'</td>
              <td class="text-right table-spend">'.round(@($row["abas"]/$row["total"]*"100"),0).'%</td>';
            } 
while($row=mysqli\u fetch\u数组($result)){
回声'
“.$row[“扇区”]”
$'.number_格式($row[“total”]/“1000”,0)。'
“.round(@($row[“abas”]/$row[“total”]*“100”),0)。”;
} 

请编写代码以帮助您!!请提供一个您尝试过的例子,以便我们可以帮助您。谢谢!我添加了一些代码