View Single Post
06-18-2007, 12:52 PM
#2
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

There are a number of approaches that you can take, I'll show you one initially. Since the values are being brought out of a database (assuming MySQL) then there are functions which you can use in the query to pull back the information you're looking for.

To total up a column of data, you can use:
Note: Replace mycolumn and mytable as appropriate
Code:
SELECT SUM(mycolumn) FROM mytable
Other similar functions like AVG (average), MAX (max value), MIN, COUNT (number of rows returned) can also be used.