Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

Mysql SUM() Functions Query

by
Category:mysql
php mysql
 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))
{

}

0 Comments


Html code work in comment box


Related Post