tags:

views:

47

answers:

1

I want to add a user score like they have on hacker news where the value of the comments on someones news submission and someones comments are added up and a score appears beside their username

so i have 3 tables

users/stories/comments

what would be the best way to do this in php/mysql?

i was thinking... 2 queries one to get all the comments and one for the submissions then loop through each to add to a variable of scores?

}
+1  A: 

I suggest the MySql sum function http://www.tizag.com/mysqlTutorial/mysqlsum.php

You can either do two querys for comments and posts ore use a more complex SQL statement to combine both.

KTB