How do I do simple sums using php? I want to add certain data in my database together where the id's are the same. For example: //id// //total// 01 5 01 4
So here i would add 5+4 together.
don't use PHP. do this with your query:
SELECT SUM(total) FROM table
You forgot the GROUP BY Mike
SELECT id, SUM(total) FROM table GROUP BY id
By the way, this thread is a double of: Simple sums.