我想将所有行中的金额相加。这是代码。请帮帮我。
$tot1=mysql_query("select SUM(Amount) from wp_product_details");
while($row1 = mysql_fetch_array($tot1))
{
echo $row1['Amount'];
}
将查询更改为使用$row1[]
的金额
$tot1=mysql_query("select SUM(Amount) as Amount from wp_product_details");
或者更改$row1[]
语法
while($row1 = mysql_fetch_array($tot1))
{
echo $row1['SUM(Amount)'];
}
试试这个代码
$tot1=mysql_query("select SUM(Amount) as amount from wp_product_details");
while($row1 = mysql_fetch_array($tot1))
{
echo $row1['amount'];
}