Jump to content

Comments

- - - - -

  • Please log in to reply
2 replies to this topic

#1
docmonkey

docmonkey

    Newbie

  • Members
  • PipPip
  • 10 posts
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
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
Have two separate tables for comments, one for users, one for companies.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
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.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users