in reply to Message Board Threading with DBI/MySQL
So, for example, message 1 has two replies (messages 2 & 3), and there are also two repies to message 2 (messages 4 & 5). The thread ids for the messages are:
Message: 1 Thread ID: NULL
Message: 2 Thread ID: "1"
Message: 3 Thread ID: "1"
Message: 4 Thread ID: "1_2"
Message: 5 Thread ID: "1_2"
This lets you use SQL LIKE to pick out the exact level you want, ie:
SELECT ... WHERE thread_id LIKE "1_2%";
to get all the messages that thread with a message at a given reply level, etc..
You can also you regular expression searches for more complex searches. Of course such searches won't be indexable.
Also, using this method, if you sort by the thread id when you get back a list of messages then you can easily examine the thread id string with Perl regular expresions to figure out at which level of indentation to display it!
Good luck!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Message Board Threading with DBI/MySQL
by Beatnik (Parson) on Jun 07, 2001 at 10:21 UTC | |
by Henri Icarus (Beadle) on Jun 07, 2001 at 17:46 UTC | |
by Beatnik (Parson) on Jun 07, 2001 at 20:15 UTC |