我想在所有行中添加金额。这是代码。请帮助我。
$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'];
}