php分页之后求某一字段整个字段的总和

各位亲,我现在做一个while循环的列表,现在从网上找到了一个方法,但是只能求出分页后这一页的和,而我想求这个字段所有的和,怎么求呢?
按搜索条件

下图就是求出来之后本页的和


下面就是我的部分php代码

echo "<center>" ;
echo "<form action ='../huwai/sou.php?action=del' method='POST' onSubmit='return confirm(\'你确定要删除这些纪录吗?\')'>" ;
echo "<table cellspacing='0' cellpadding='2' border='1' bordercolor='#66FF66' width='1400px'>" ;
echo "<tr bgcolor='#FFFFCC' align='center' height='20px'>" ;
echo "<th width='50px'><strong>ID号</strong></th>" ;
echo "<th><strong>日期</strong></th>" ;
echo "<th width='50px'><strong>编号</strong></th>" ;
echo "<th width='50px'><strong>县区</strong></th>" ;
echo "<th width='400px'><strong>具体地址</strong></th>" ;
echo "<th width='50px'><strong>科室</strong></th>" ;
echo "<th width='50px'><strong>姓名</strong></th>" ;
echo "<th width='60px'><strong>联系电话</strong></th>" ;
echo "<th width='30px'><strong>油</strong></th>" ;
echo "<th width='30px'><strong>米</strong></th>" ;
echo "<th width='30px'><strong>围裙</strong></th>" ;
echo "<th width='30px'><strong>现金</strong></th>" ;
echo "<th width='50px'><strong>皮革抽纸盒</strong></th>" ;
echo "<th width='50px'><strong>水宜生杯子</strong></th>" ;
echo "<th width='50px'><strong>三件套水杯</strong></th>" ;
echo "<th width='30px'><strong>高</strong></th>" ;
echo "<th width='30px'><strong>长</strong></th>" ;
echo "<th width='30px'><strong>面积</strong></th>" ;
echo "<th width='30px'><strong>安装结果</strong></th>" ;
echo "<th width='300px'><strong>备注</strong></th>" ;
echo "<th width='20px'><strong>结账状态</strong></th>" ;
echo "<th colspan='3' align='center'></th>" ;
echo "</tr>" ;

$num=8;
$sql1="select * from place {$where}";
$result1=mysql_query($sql1);
$total=mysql_num_rows($result1);
$page=new Page($total,$num,$args);
$sql="select id,time,number,xianqu,address,keshi,name,tel,you,mi,weiqun,money,pgczh,beizi,sjtsb,high,width,area,azjg,bz,jzzt from place {$where} order by `id` DESC {$page->limit}";
$result=mysql_query($sql);
while(list($id,$time,$number,$xianqu,$address,$keshi,$name,$tel,$you,$mi,$weiqun,$money,$pgczh,$beizi,$sjtsb,$high,$width,$area,$azjg,$bz,$jzzt)=mysql_fetch_row($result)){
echo "<tr>";
echo "<td>$id</td>";
echo "<td>$time</td>";
echo "<td class='number'>$number</td>";
echo "<td>$xianqu</td>";
echo "<td>$address</td>";
echo "<td>$keshi</td>";
echo "<td>$name</td>";
echo "<td>$tel</td>";
echo "<td>$you</td>";
echo "<td>$mi</td>";
echo "<td>$weiqun</td>";
echo "<td>$money</td>";
echo "<td>$pgczh</td>";
echo "<td>$beizi</td>";
echo "<td>$sjtsb</td>";
echo "<td>$high</td>";
echo "<td>$width</td>";
echo "<td>$area</td>";
echo "<td>$azjg</td>";
echo "<td>$bz</td>";
echo "<td>$jzzt</td>";
echo "<td><a href='../huwai/huwaimod.php?action=mod&id=$id'>修改</a></td>";
echo "<td><a href='../huwai/sou.php?action=del&id=$id' οnclick='return confirm('确定要删除?')'>删除</a></td>";
echo "<td><input type='checkbox' name='id[ ]' value ='$id' ></td>";
echo "</tr>";
$totalarea += $area;
}

echo "<tr><td colspan='21' align='center'><span class='fenye'><ul class='fr'> {$page->fpage(array(1,8,2,3,4,5,6,7,0))}</ul></span></td><td colspan='3' align='center'><input type='submit' name='dosubmit' value='删除'/></td></tr>";
echo "<tr><td colspan='24' align='center'>总面积<本页合计>:&nbsp;".$totalarea."&nbsp;平方米(按搜索条件计算)</td></tr>";
echo "</table>";
echo "</form>";
echo "</center>";


我现在呢?就是想求出搜索出来之后,$area 这个字段所有相加的和!
有高手帮忙分享解决办法吧,谢谢!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值