+----------+-----------------------+
| id | amount |
+----------+-----------------------+
| 1 | 20 |
| 2 | 40 |
| 3 | 60 |
我想使用 php 合并所有金额并最终得到 120 ( 20 + 40 + 60 )
$query = mysql_query("SELECT * FROM table");
while($row = mysql_fetch_array($query)){
$result = $row + $row; // of course false, just an example
}
怎么做 ?