Jump to content

Blog-like DB structure


lugos

Recommended Posts

Hello,I'm relatively new to SQL and databases in general. I am not too familar with the terminology. I want to do a personal website where I can post messages and allow people to respond (similar to a blog). For the database structure/design, I was thinking of having one table for my original message, and in that table including an INT column that the database automatically increments every time a new row is created (it will be a unique field). The number generated by the database will then be used as a key/identifier in another table that contains the responses. That key/identifier will be used to link the responses to my original message. I hope that makes sense.So basically my question is if this sounds like it can work? Also, feedback and/or suggestions will be greatly appreciated. If there is a better way I would gladly consider it.Thanks,lugos

Link to comment
Share on other sites

I usually make a column named ID, int type, unsigned, auto_increment, primary key, for every table, even if it will never actually be used. So what you are saying sounds very logical.

Link to comment
Share on other sites

I was thinking of having one table for my original message, and in that table including an INT column that the database automatically increments every time a new row is created (it will be a unique field).  The number generated by the database will then be used as a key/identifier in another table that contains the responses.  That key/identifier will be used to link the responses to my original message.  I hope that makes sense.So basically my question is if this sounds like it can work?

You logic is perfect as far as i understand about database design. I did something like this in my site following this very logic and it works perfectly.A suggestion is to always put an unique identifier even in the responses table in the case you want to edit the responses (bad words, etc). Think this way: every thing you might edit or other tables will take as reference (foreigner key stuff) should have an unique identifier.
Link to comment
Share on other sites

  • 1 month later...
If you're more into the Blog aspect rather than the coding aspect (although you seem to have the coding down), you should look into the WordPress PHP/MySQL Blog management system.http://wordpress.org if you're interested.
Word Press is alright, I used it for a while. It does seem to have issues when running with PHP5 and I found the editing the templates complicated.Why does every little piece of the template have to have like 3 files? I spend most of the time trying to find the thing I need to change.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...