Ranjit Singh Ranjit Singh - 2 months ago 5x
PHP Question

How to calculate of SUM of values?

i am new in PHP. I am trying to SUM of values which i am fetching from database. Would you tell me how to calculate of fetch data from database. Below i am showing you the output and code of PHP. I want total of Amount values

This is output


If you want to sum of amount then go with this

Example SQL query:

select sum(column_name) as total from your table_name

Then fetch the result in PHP

echo $fetched_data['total'];