Skip to main content
Participant
April 26, 2008
Question

PHP & MySQL Calculations

Hi, I was wondering if anyone could take the time to mull over this and maybe put me in the right direction,

I have a database with a students tabel, and there is a field for 'score'.

I have managed to display all the students merit scores in a table (I cheated and used Dreamweaver for this)

I want to add a row at the bottom of the table that adds up all the scores.

I am finding this hard as I have just put a repeat region around the {teachers_students.merit} field.

Could anyone help me out with calculating these total?

Thanks in advance.
If you know of a site that helps with this please post.
This topic is closed to new replies. Start a new post to keep the conversation going.

1 reply

Inspiring
April 27, 2008
godonholiday wrote:
> Hi, I was wondering if anyone could take the time to mull over this and maybe
> put me in the right direction,
>
> I have a database with a students tabel, and there is a field for 'score'.
>
> I have managed to display all the students merit scores in a table (I cheated
> and used Dreamweaver for this)
>
> I want to add a row at the bottom of the table that adds up all the scores.
>
> I am finding this hard as I have just put a repeat region around the
> {teachers_students.merit} field.
>
> Could anyone help me out with calculating these total?
>
> Thanks in advance.
> If you know of a site that helps with this please post.
>
I would create a second query in mysql:

select SUM(columnName) from tableName;

The same thing can be done using PHP or javascript, but the mysql
operation would be simpler.

Mick.
Translate