Mysql Sum列[重复]

This question already has an answer here:

i am new to mysql so im trying to make payment schedule for my work. I need to have a total of the numbers displayed as "payment".

<?php

        $sql = "SELECT id, DATE_FORMAT(datum, '%d/%m/%Y'), tijd, uren, floor(uren*loon) as payment FROM uren_gewerkt";

        $result = $conn->query($sql);

        if ($result->num_rows > 0) {
            echo "<table><tr><th>Datum</th><th>Tijden</th><th>Uren</th><th>Loon</th></tr>";
            // output data of each row
            while($row = $result->fetch_assoc()) {
                echo "<tr><td>".$row["DATE_FORMAT(datum, '%d/%m/%Y')"]."</td><td>".$row["tijd"]."</td><td>".$row["uren"]."</td><td>&euro;".$row["payment"]."</td></tr>";
            }
            echo "</table>";

            echo "Totaal:"; //Sum of payment goes here

        } 
        else {
            echo "0 results";
        }
    ?>

Note "Loon" (From floor(uren*loon) is a fixed number (9.56)

image of table

</div>
SELECT SUM(floor(uren*loon)) as total FROM uren_gewerkt

Or do it in PHP:

$total = 0;
//here goes your while loop
while($row = $result->fetch_assoc()) {
    echo "<tr><td>".$row["DATE_FORMAT(datum, '%d/%m/%Y')"]."</td><td>".$row["tijd"]."</td><td>".$row["uren"]."</td><td>&euro;".$row["payment"]."</td></tr>";
    $total += $row["payment"];
}
echo "Totaal: &euro;".$total;