ok i think this is common, you want to have a regular blog entry, portfolio, etc to have comments
so what i can do is have these tables
BLOG
PORTFOLIO
BLOG_COMMENTS
PORTFOLIO_COMMENTS
but since both comments table will have the same columns, can i merge them? so that they can reference from 2 tables? is it possible?
How do i implement Coments that span multiple tables
Moderator: General Moderators
-
iceangel89
- Forum Commoner
- Posts: 39
- Joined: Mon Jul 02, 2007 7:02 pm
-
iceangel89
- Forum Commoner
- Posts: 39
- Joined: Mon Jul 02, 2007 7:02 pm
how do i do it?feyd wrote:Yes, it's possible.
BLOG will have things like: BlogID, Title, Content, DateTime, UserID - it can have more but for nowcalifdon wrote:Without knowing what is in those tables, it's impossible to answer your question.
PORTFOLIO shld have: PortfolioID, Title, Content, ImageURL,
COMMENTS table will have CommentID, UserID, Content, and either BlogID or CommentID
actually, what do [s]u[/s] you guys have in [s]ur[/s] your tables and do [s]u[/s] you do from scratch? or use a CMS/Blogger? i was thinking doing from scratch allows me more practice?
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.
Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.
If you are referring to this forum (which is not a blog or CMS and requires very different logic than those applications), it is just a standard phpBB forum, customized with our logo. It probably required more than a man-year to write, by very experienced programmers. I commend you on your eagerness to learn, and writing software from scratch is an excellent way to learn, but you need to start with a much simpler project. When you ask a simple question about a complex topic, you're likely to get answers that won't fit your needs. Your original question was:
If you find this discussion too complex or too boring, it's because this is the business of database design. There are no shortcuts. It's complex and sometimes boring.
The answer to that question would depend on a whole lot of other factors. The short answer is Yes, anything is possible. That's what feyd meant in his response. The long answer involves everything else in your database, as to whether merging tables makes sense. In relational database theory, a table represents an entity in the part of the real world that your database is modeling, so unless I know exactly what you are trying to model, I can't give you any useful answer as to how to structure your tables. It would take a lot of discussion and analysis. In some cases, all the Comments should be in the same table, in other cases, they should not. It all depends on the rest of your data and their relationships.since both comments table will have the same columns, can i merge them? so that they can reference from 2 tables? is it possible?
If you find this discussion too complex or too boring, it's because this is the business of database design. There are no shortcuts. It's complex and sometimes boring.