我想在所有行中添加金额。这里是代码。请帮助我。PHP添加行时出错
$tot1=mysql_query("select SUM(Amount) from wp_product_details");
while($row1 = mysql_fetch_array($tot1))
{
echo $row1['Amount'];
}
我想在所有行中添加金额。这里是代码。请帮助我。PHP添加行时出错
$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)'];
}
在这段代码中没有结果 – raghu 2012-07-29 07:56:25
在phpmyadmin中试试这个sql查询 – bugwheels94 2012-07-29 07:59:27
试试这个代码
$tot1=mysql_query("select SUM(Amount) as amount from wp_product_details");
while($row1 = mysql_fetch_array($tot1))
{
echo $row1['amount'];
}
你有没有尝试$行[ 'SUM(金额)']? – Raiden 2012-07-29 07:50:12
我试过了,但没有结果 – raghu 2012-07-29 07:52:03
试试这个:'选择SUM(金额)作为金额来自wp_product_details' – 2012-07-29 07:52:54