Jump to content

How to add messages+userIDs to my blog post table


redmarine

Recommended Posts

My goal is to create a blog like site that sorts blog posts (entry) by ID, however, what puzzles me is how I should go about storing messages, as well as the posters ID, for each of my blog posts. How should I do this in the database table?

 

This is the basic structure of my table so far, figured it would be dumb to make the whole thing if I'd have to rework it all:

 

CREATE TABLE `database`.`blog post` (
`id` INT NOT NULL AUTO_INCREMENT ,
`title` VARCHAR( 100 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM ;

 

Anyhow, how would I go about creating a new column that could store all posts+user ids? Would it require linking two or more tables together?

 

I'm running my database on MySQL client version 5.0.7

 

Advices or links to tutorials/threads that would solve my issue would be appreciated!

Link to comment
Share on other sites

Google it, i found several that can answer your question. Then come back and we'll help you

That's not very helpful.

 

My apologies if it came off that I was being mean or abrupt; but the rules even say to try something yourself before asking for help. The fact that a google search found his answer is not me being unhelpful, I pointed him in the right direction. (Something you've done to me a few times  :P)

Link to comment
Share on other sites

Google it, i found several that can answer your question. Then come back and we'll help you

That's not very helpful.

 

My apologies if it came off that I was being mean or abrupt; but the rules even say to try something yourself before asking for help. The fact that a google search found his answer is not me being unhelpful, I pointed him in the right direction. (Something you've done to me a few times  :P)

 

Well, as you can probably tell English isn't my native language so I'm pretty pathetic when it comes to searching for technical stuff on the internet, even more so that I'm 1 month into this whole database and table thing.

 

Google it, i found several that can answer your question. Then come back and we'll help you

That's not very helpful.

 

What's the purpose of this new column?

 

It's more a question of how I should store the comments that will be posted on the blog. Since I'm pretty new to this whole database and table thing I'm still trying to figure out the possibilities as well as the limitations of them.

 

What I thought was possible was to perhaps add a new column to the table for storing comments, however, I can't seem to store more than just a single comment.

 

Would you know how I should go about handling this? I'm open for entirely different solutions if my idea is broken.

Link to comment
Share on other sites

Google it, i found several that can answer your question. Then come back and we'll help you

That's not very helpful.

 

My apologies if it came off that I was being mean or abrupt; but the rules even say to try something yourself before asking for help. The fact that a google search found his answer is not me being unhelpful, I pointed him in the right direction. (Something you've done to me a few times  :P)

At the very least, some URLs might have helped.

Link to comment
Share on other sites

As DevilsAdvocate mentioned, normalization appears to be quite a big factor when it comes to designing tables so I'm probably going to study them for a bit and do more research into what makes a database. I didn't know that making databases was this complex but it appears to be fun enough to try out.

 

I'll periodically check this thread, in the next couple of days, about any additional tips you guys may have for me on how to solve my particular problem.

 

Anyhow, thanks for your help so far.

Link to comment
Share on other sites

Google it, i found several that can answer your question. Then come back and we'll help you

That's not very helpful.

 

My apologies if it came off that I was being mean or abrupt; but the rules even say to try something yourself before asking for help. The fact that a google search found his answer is not me being unhelpful, I pointed him in the right direction. (Something you've done to me a few times  :P)

At the very least, some URLs might have helped.

 

Ok, I'll give you that

 

 

As DevilsAdvocate mentioned, normalization appears to be quite a big factor when it comes to designing tables so I'm probably going to study them for a bit and do more research into what makes a database. I didn't know that making databases was this complex but it appears to be fun enough to try out.

 

I'll periodically check this thread, in the next couple of days, about any additional tips you guys may have for me on how to solve my particular problem.

 

Anyhow, thanks for your help so far.

 

The big thing is understanding when and why. Related info should be stored in like tables.

 

So for your use, you would have a User table and a comment table. Each would have a unique ID (the primary key). The Comments table would hold the User Primary key in it as the foriegn key, linking the comment to the user. That way, if something changes in the user table, it doesn't need to in the comments table and the other way around.

 

Let us know if you run into any snags

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.