Hello, As Adam pointed out, this can be deadly to your database, especially as the number of posts grows. If you want to go that route, I would recommend selecting all the posts in that particular thread and sorting the data out in PHP somehow. No need to slam your database with (potentially) hundreds of queries to display a discussion. Multiply that by several page views at once... If you don't mind the extra work and investigation, I would recommend downloading some PHP forum software that supports threaded discussion and see how they implement it. I found several listed in DMOZ: http://dmoz.org/Computers/Programming/Languages/PHP/Scripts/Forums/ Let us know what you come up with! I'd like to see how you work this out. This is a good computer science type of problem with practical application - the kind of stuff they should have taught me in school but never did. ~(o: Best of luck, -K.Bear > <SOLVED>, almost. I read the article suggested by K.Bear and found the > recommended solution to be a bit more complicated than I wanted to > implement. I then found another way to do this using the existing > "Adjacency List Model" through a recursive function. So basically, you > query the database for the post_id of the very first post in the > discussion. You then call a function that displays that post, searches > for all children of that post and then calls itself recursively on > each of the children it discovers. This works great for spitting out > the posts in the proper order. Now I'm trying to figure out how to > make sure the indenting looks right in the browser. > > - Ben > >> Wouldn't that involve a separate SQL query for every post? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php