Mysql SUM() Functions Query

The SUM() function returns the total sum of a numeric column.

To understand SUM function, consider an products table, which is having the following query.

First you can need database connection in php

Code

$sql = "SELECT SUM(price) FROM Products"; 
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_assoc($result))
{

}

@Copyright ScriptsGurus 2023