Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to create a user based website, where other users can report users that misbehave.

I have a database table for users and one of the columns is a count of the amount of times they have been reported (default value 0). As a user is reported by others, the value in this column goes up, for example, if 3 separate users report user A, user A's report count would be 3.

My question is:

What would be the best way to do this?

Many thanks,

Joel.
Posted

1 solution

> What would be the best way to do this?

You may want to consider simply adding a row to the Report table when a report is made. Counting the rows associated with a specific user will give you the count of reports. This has the added benefit of retrieving counts for a specific period, or by a specific user, or both.

/ravi
 
Share this answer
 
Comments
PIEBALDconsult 13-Jan-15 15:31pm    
Yes, that is the correct way.
Santosh K. Tripathi 13-Jan-15 23:34pm    
this is the correct, way go with it.
jba1991 14-Jan-15 9:04am    
Thanks very much Ravi,

Sorry for such a vague question, but I didnt even know what to search Google for so came here.
Ravi Bhavnani 14-Jan-15 9:08am    
No apology needed. We're here to help (if we can).

Cheers,

/ravi
jba1991 14-Jan-15 9:09am    
If I create the reports table and have userID and reports as columns, would I join the user table and reports table on userID? Meaning that each report in the reports table will be associated with a userID and from there would I count the amount of rows where userID = XX?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900