Ranjit Singh Ranjit Singh - 1 year ago 112
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

Answer Source

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'];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download