hello,
When you want to sum() a column of number you need to tell the database what number you want to sum.
For example say that you have 100 records in a table and you have two columns id and cpaid. Possibly the id column has something like 1 to 100 for all records.
You would tell the database to do something like
$sql = "SELECT id, sum(cpaid) as paid from sometable WHERE id < 50 GROUP BY cpaid";
When using sum() you have to use the "GROUP BY" statment so that the database knows where to sum() the numbers. Basically you just tell it what sumn to sum(). Then you can use the "WHERE" statment to limit the numbers in the column.
Check out the mysql manual for more information
http://www.mysql.de/doc/en/GROUP-BY-Modifiers.html.
hope this helps,
- justin