fesan Posted January 31, 2011 Share Posted January 31, 2011 Hi... I want to create a fully functional forum, like PHPBB, maby not as advanced but that does the same job. I do this to teach myself a huge amount of PHP and MySQL. I´ve done PHP and MySQL programming for 6-7 years but just on a hobby basis, so I´m familiar with writing the code. I sat down to brainstorm a bit about the project when i got to the structure of the database i hesitated on how to do a good structure for a forum database. I thought first of all to have all the forum posts in one table with relation to the forum subject and topic table. But i thought that having all the posts in one table might be a slow system? Should the posts be separated or is this ok? I understand that this depends on the size of the forum and the amount of posts in the database. How do you do a good database structure in a table with a huge amount of rows that should go in the same table? First table layout: Forum name - cars or flowers? Topic name - carburetors or Daisies (a relation to forum topic so it organizes under the correct forum name) Forum post - how do i grow a daisy? (a relation to both topic name and forum name for organizing) Quote Link to comment https://forums.phpfreaks.com/topic/226259-new-db/ Share on other sites More sharing options...
ttocskcaj Posted February 2, 2011 Share Posted February 2, 2011 Browse through my source here: https://github.com/ttocskcaj/The-Forum-Framework/ Pretty much, I have 3 tables to handle the posts. * forum - different categories for threads to go in. Eg "PHP Coding Help" * thread - eg "New DB" * post - eg "Re: New DB" Each post belongs to a thread, and are linked with an ID (integer). Each thread belongs to a forum ane are linked with an ID (iteger). Each post is also linked to a user with an ID. I have a different class to handle each table, kind of like a model (in MVC) I guess. Here's the sql for my database. https://github.com/ttocskcaj/The-Forum-Framework/blob/master/sql/tffw_sql.sql Keep in mind that I'm still working on mine to. Quote Link to comment https://forums.phpfreaks.com/topic/226259-new-db/#findComment-1168749 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.