开发者

most sensible way to do this?

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 o开发者_开发知识库ne to get all the comments and one for the submissions then loop through each to add to a variable of scores?

}


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜