嗨,我是php的新手,所以我正在做一个项目,我必须从我的表中获得总金额的总和,我找到了总金额,但如何回显或打印到我的主页。
$sum = $this->Payment->find('all', array(
'conditions' => array('Payment.amount ' ),
'fields' => array('sum(Payment.amount ) as total_sum')
));
Array
(
[0] => Array
(
[0] => Array
(
[total_sum] => 490.00
)
)
)
发布于 2017-06-16 12:43:50
您可以这样做:
echo $sum[0][0]['total_sum];
这将打印出490.00
。
https://stackoverflow.com/questions/44589529
复制