Welcome Guest, Not a member yet? Register   Sign In
Ideal structure for categories in blog
#1

[eluser]Michal1[/eluser]
Hi,

I am trying to figure out what is the best structure for categories in blog system.
Lets say I want to be able to create new categories in my admin panel and assign articles into them.

I thought that the best way would be have a table

"articles" which would have rows like "id" "content" "category id"

then I would have a new table called "category" which would have rows like "category id" "name of category".

Is it a right and easy approach or is there some better and easier way?

Thanks
#2

[eluser]Unknown[/eluser]
Maybe it might help taking a look at other blogs ? Wink
#3

[eluser]Cristian Gilè[/eluser]
What if your article could have more than one category?

Code:
ARTICLE table:
-id
-title
-text

CATEGORY table:
-id
-name

ARTICLE_CATEGORY table:
-id
-article_id
-category_id


Cristian Gilè
#4

[eluser]InsiteFX[/eluser]
Do not forget that you may also have comments for articles!

Maybe tags also.

InsiteFX




Theme © iAndrew 2016 - Forum software by © MyBB