Good description. One minor addition I would suggest: That schema only allows for one level of replies. Add a parentpostid to the posts table and you can easily handle replies to replies to replies to replies (etc) to a thread.
Stuart -----Original Message----- From: Kevin Stone [mailto:[EMAIL PROTECTED]] Sent: 24 April 2002 22:03 To: [EMAIL PROTECTED] Subject: Re: [PHP] bulletin board algorithm in php - how to write one? Plain english eh? Oookay... :) Well it's pretty obvious you'll want to store the data somehow. I'd recommend using a MySQL database. For a simple forum script you'll want to have two tables in your database. A Thread table and a Post table. The Thread table will store (threadid, username, subject title, date). The Post table will store (postid, threadid username, message, date). ThreadID will be be used in the Post table to connect each post with the right thread. When a user fills out the New Thread form and hits submit that information is stored in the Thread table. The message he adds will be stored in the Post table as the first post to that thread. When a user fills out the Reply form and hits submit that information is stored in the Post table. The threadid is recorded to match the post with that thread. Now when a user views the forum script it will extract all data from the Threads table and display a page of all threads linked to their threadids. So when a user clicks on a thread the script searches for that threadid in the Posts table and displays a page of all posts relating to that threadid. Bing Badda Boom... you've got yourself a quaint little forum script. But it doesn't do much yet. It just allows you to create threads and add posts to those threads. You may also want to have multiple forums in which case you would add a Forums table and a forumid column to the Threads table. The forumid relates to the threadid relates to the postid. Adding deletion, editing and search functions is trivial. User login and authentication is an entirely different discussion. Hope this helps, Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php