sweet table design - TechRepublic
General discussion
November 16, 2005 at 09:01 AM
jaqui

sweet table design

by jaqui . Updated 20 years, 7 months ago

for a threaded discussion.

The field names:
post_id root_id parent_id subject content Author Date

this will actually allow for the tree view of the TR forums will all but use login contained in the one table.
root_id is the thread head subject, such as the Software/Web Development this thread is posted in.
parent_id is equal to root_id for originating post of a discussion.
post_id is the actual posting. [ naturally ]

so a query run agains this table tests for root id to display the topic, parent id to display previous post, testing these two for being equal to see if this is a discussion starter.
if a mid discussion posting then put links to previous post and next post. 🙂

naturally this is a basic table, by adding fields for tags or other searchable content you gain more flexability in the user interaction.

this table actually uses far less overhead in the database than most, since only the very first call to the display script will not have a “select all from table where parent_id && post_id = ” line in the query, meaning it’s selecting where root_id = 0 ( discussion Front Page ) after the front page you are either selecting a specific thread, or a specific subject grouping.

This discussion is locked

All Comments