Basicly I want to make something like a tree view forum (like the one at http://forum.qb45.com/index.php?board=php )
Say my table has the following fields
id, reply_to, message, user, date, subject
The reply_to field points the 'id' name of the parent message. If the message is the root message of the thread, the value will be 0.
what I want to know, is there a way of making a SQL query that is recursive (I guess that's the right spelling), so that I could use one single SQL query to read out a message, and all of it's replies in to a result that held the 'tree' structure of the replies. Once this is done, how would I make this result into an array, without lossing the 'tree' structure.
If someone could give me some pusdeo-cod for this. I'm using MySQL (but using the PEAR DB Lib).
Thanks in advance to all who reply
Jason