Welcome Guest, Not a member yet? Register   Sign In
db scheme question...
#2

[eluser]missionsix[/eluser]
You should use a single comments table, but your thinking about it wrong.

What you want here is a many to many relationship between tables.

So lets say you have articles, and want to add comments to them. you should have an intermediate table that stores the relationships between articles & comments.

Code:
+- Articles -+
--------------
-- id
-- ect..
--------------

+- Article_Comments -+
----------------------
--  Article_id
--  Comment_id
----------------------

+- Comments -+
--------------
-- ID    
-- comment
-- ect...
--------------

So you would create the relationship table for every thing that you want to add comments to. Then, you can add to your model, a way to retrieve comments using a joins based on comment_id from that table.



Hope that helps!


Messages In This Thread
db scheme question... - by El Forum - 12-12-2008, 05:31 PM
db scheme question... - by El Forum - 12-12-2008, 05:37 PM
db scheme question... - by El Forum - 12-12-2008, 05:47 PM
db scheme question... - by El Forum - 12-12-2008, 11:47 PM
db scheme question... - by El Forum - 12-13-2008, 12:06 AM
db scheme question... - by El Forum - 12-13-2008, 12:12 AM
db scheme question... - by El Forum - 12-13-2008, 12:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB