-3
我有一個像下面這樣的聲明,我需要在表的末尾添加所有發票總計。我的老闆想知道所有發票的月份總數。在mysqli SELECT語句的每一行中添加同一列中的所有值
$r = $mysqli->query("SELECT * FROM invoice WHERE parent_id = '0' ");
while ($row = $r->fetch_array(MYSQLI_ASSOC))
{
echo '<table>';
echo '<tr>';
echo '<td>' . $row['invoice_total'] . '</td>';
echo '</tr>';
}
echo '</table>';
你可以用'SUM()'https://dev.mysql.com/doc/refman/5.0/en/group-by-functions。 html#function_sum - http://www.tizag.com/mysqlTutorial/mysqlsum.php –