开发者

most sensible way to do this?

开发者 https://www.devze.com 2022-12-22 07:23 出处:网络
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

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

精彩评论

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

关注公众号