I am currently designing a database that will need to support the use of comments. The comments can either be attached to a particular user (a user posts a comment that shows up on a person's page) or the comment can show up on a company.
What is the best way to set this up in terms of structure in the database? I want to allow for threads in the future, but not necessarily now, so I'm wondering how to handle parent_id 's
Thanks
2 replies to this topic
#1
Posted 27 June 2011 - 12:11 PM
|
|
|
#2
Posted 27 June 2011 - 02:20 PM
Have two separate tables for comments, one for users, one for companies.
#3
Posted 28 June 2011 - 03:31 AM
Yes, you would not wish to store them in the same table (this would hold a lot of redundant data for searching just one of two sets of comments) so you would wish to have two separate tables each with the parent id, author id and of course data relating to the comment
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









