I have a HTML
table with numbers, I'm trying to get the SUM
to display on the bottom of table beneath the numbers using MySql
.
function test_sum(){
$query = "SELECT SUM(test_column) FROM" . $this->table_name . " ";
$stmt = $this->conn->prepare( $query );
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);
$this->test_column = $row['SUM(test_column)'];
}
Full code I'm trying to use to display the results
$stmt = $class_name->test_sum();
$row = $stmt->fetch(PDO::FETCH_ASSOC){
echo "$row['SUM(test_column)']";
}