This is the result of my attempts to create forum software in PHP. I would have finished it but I feel my site is not ready for a forum yet ^_^.
ShowThread() is the only function of interest, all the others are just helper functions. To create a new Thread, use ReplyToMessage(null, 0). In ShowMessage() I artificially created a limit to how much recursion there can be in a single thread. To run, this script requires the param() function. I encourage everyone to experiment with the helper functions to achieve different looks. Finally, the guests table has to filled in by hand... I haven't implemented a sign-up script yet.