如何从sql查看php的总价格/成本?

How to view the total price in php from sql?

Example: SQL

Item               Price
Phone1             1200
Phone2             1341
Phone3             2140
Phone4              850
Phone5              903
                 ---------
      Total Price: 6434             
echo mysql_result(mysql_query("SELECT sum(Price) FROM table"), 0);

You can get sum() in SQL

SELECT sum(Price) FROM table

in PHP

$sum = 0;
while($row = mysql_fetch_assoc($query)) {
    $sum += $row['Price'];
}