You are here: Re: Advice on forum to built « PHP Programming Language « IT news, forums, messages
Re: Advice on forum to built

Posted by Lόpher Cypher on 01/03/06 16:57

frizzle wrote:
> Hi there,
>
> I'm going to build a simple forum in mySQL.
> I've thought about it for a while now, but still can't figure it
> out completely:
>
> If i have say 5 main categories,
> One has 5 sub-categories.
> Each sub category consists of individual threads.
> Wich each has the possibility to be commented.
>
> The question concerns the thread & comments part.
> My first idea was to create one table Threads, and one
> Comments.
> The Threads-table would have the original post, starting a thread,
> and the Comments table would have the comment, and the id of
> the thread it belongs to. (so all comments there are in the whole
> forum)
>
> Now i thought of the following:
> I could create a new table for each thread to save it's comments in.
> And call it e.g. 'Comments_4576', (belonging to thread 4576)
>
> Pro is a lot faster to load, delete etc. but contra is more difficult
> to
> count cross-tables and everything.
>
> What could i do best?
>

As you said in the beginning :)

TABLE Category
ID
...
ParentID ... REFERENCES Table(ID)

TABLE Thread
ID
...

TABLE Message
ID
...
ThreadID ... REFERENCES Thread(ID)
ReplyTo ... REFERENCES Message(ID)

is one possibility coming from

1) Category may have subcategories (0..*)
2) Subcategory must have parent category (1)
3) Category consists of threads (0..*)
4) Thread consists of messages (1..*)
5) Message could either be top-level or a reply to one of the messages
in thread

Another possibility is a "linear" thread, i.e. posts are simply listed
one after another, in which case there is no ReplyTo field.
I wouldn't say that having a table for each thread is a good design.

Read some on relational database design :)
Btw, I think this is rather a topic for design or sql group :) Has
nothing to do with PHP :)


--

- lΓΌpher
---------------------------------------------
"Man sieht nur das, was man weiß" (Goethe)

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация