Hi.. im planning on writing a small threaded message board for my site, much like the one here.. but im un sure of how to approach the thing... what i reckon is a table like this:
INT msg_id
INT msg_parent
TEXT msg_body
TIMESTAMP msg_date
(ofcourse, a bit more comprehensive, but anyway)...
and then, pick, say 10 messages, with 'msg_parent == 0' (eg, top msgs), and sorted by timestamp..
then for each of those 10 msgs, do a PHP for loop, to grab anything below them (eg, with the parent == that msg_id).. and keep doing that for each msg, submsg, sub sub msg and so on...
but this seems very inofficient to me..
so my question is, what is the best way to approach this?
David.
INT msg_id
INT msg_parent
TEXT msg_body
TIMESTAMP msg_date
(ofcourse, a bit more comprehensive, but anyway)...
and then, pick, say 10 messages, with 'msg_parent == 0' (eg, top msgs), and sorted by timestamp..
then for each of those 10 msgs, do a PHP for loop, to grab anything below them (eg, with the parent == that msg_id).. and keep doing that for each msg, submsg, sub sub msg and so on...
but this seems very inofficient to me..
so my question is, what is the best way to approach this?
David.