I'd set it up by hash table. Have an id for each post, and a "parent" id for each one. Ex:

the thread would get (for example) and id of 1 and get a parent id of, say, -1 saying that its a parent. Next, a post in that same thread would have a new id (make it two for the example), but the parent id of 1 saying that its attached to the thread. So you end up with a tree of thread topics like:

Main Discussion (ID:1,PID:-1)
Script Help (ID:2,PID:-1)
Problems (ID:3,PID:-1)

Then say someone makes a thread under main, it would look like:

Hello everyone (ID:4,PID:1)
This is some text in a thread that someone can respond to

Then a post under that would get:

Reply: Hello everyone (ID:5,PID:4)
Hoows it goin

Now you end up with a tree:

Code:
[ Main Discussion ]             (ID:1,PID:-1)
  +- Hello Everyone             (ID:4,PID:1)
    +- Reply: Hello everyone    (ID:5,PID:4)
    +- Reply: Hello everyone    (ID:6,PID:4)

[ Script Help ]                 (ID:2,PID:-1)
  +- New Thread                 (ID:7,PID:2)
    +- Reply: New Thread        (ID:8,PID:7)

[ Problems ]                    (ID:3,PID:-1)

When you want all the posts in the Main Discussion board, do a search for those with a PID value of 1, and likewise to get posts off a thread. Look for a PID value of that thread.

It might sound complicated at first, but that's exactly what forums like this one do. >:D


-KingTomato