1

我想在所有行中添加金额。这是代码。请帮助我。

$tot1=mysql_query("select SUM(Amount) from wp_product_details"); 
while($row1 = mysql_fetch_array($tot1))
{
echo $row1['Amount'];
}
4

2 回答 2

2

稍微更改您的查询以使用数量$row1[]

$tot1=mysql_query("select SUM(Amount) as Amount from wp_product_details"); 

或者改变你的$row1[]语法

while($row1 = mysql_fetch_array($tot1))
{
echo $row1['SUM(Amount)'];
}
于 2012-07-29T07:52:39.143 回答
0

试试这个代码

 $tot1=mysql_query("select SUM(Amount) as amount from wp_product_details"); 
    while($row1 = mysql_fetch_array($tot1))
    {
    echo $row1['amount'];
    }
于 2012-07-29T07:58:13.350 回答