All 3 tables contain a field categoryID, so basicle each post-product-question belong to a specific category. I’d like to know which is the best way to create my categories.
Create n-different category tables each time, such as posts_categories, products_categories, faq_categories etc etc, so basicly there all will be indipendent.
Create a single table for all categories with the following fields
Categories
--------------------
categoryID
category
type * // values (probably set as ENUM type - from a dropdown menu): posts, products, faqs etc etc
I thought i should organize all my categories based on each section (type), because there maybe cases where i might need to display some categories, for example on a blogi could show all categories with post type, right? all other types ( products, faqs etc) might not make sence to show them on a blog page.
I may have also found a little problem here. What if there’s a category that appears in more than one sections??
See my example bellow
[table=“width: 500”]
[tr]
[td]categoryID[/td]
[td]category[/td]
[td]type[/td]
[/tr]
[tr]
[td]1[/td]
[td]Science[/td]
[td]posts[/td]
[/tr]
[tr]
[td]2[/td]
[td]Design[/td]
[td]posts[/td]
[/tr]
[tr]
[td]2[/td]
[td]Design[/td]
[td]faqs[/td]
[/tr]
[tr]
[td]3[/td]
[td]Shirts[/td]
[td]products[/td]
[/tr]
[/table]
Do I have to take ‘design’ as two different categories and do 2 INSERTs (something like duplcicate records, but the ‘type’ will be different each time) or is there a better way to do this ?