Jump to content

Recommended Posts

Hello everybody

 

I'm developing a simple product-gallery website. Due to my client request, I should code it from scratch and don't use CMS such as wordpress. I wonder what is the best way for a product to have cateogries? Let me explain:

 

I have product A which is a Laptop. It has following categories:

 

ASUS, light, expensive, office, award-winner

 

Each of the above words a category. For instance the cateogry "office" includes laptop appropriate for office and non-graphical tasks and the other words are explanatory as well. Then, I want to make a product table, what is the best solution for category field? Should I make a column for each cateogry, in that way I have to impose a limit on it. For instance 5 columns for category which makes it limited. Or, I should use only one category and separate them with comma. In that way I should use a little reg exp.

 

What is your suggestion?

 

thanks in advance

 

you seem to have mixed up categorys and tags.  But anyway, given this kind of layout I would have an id/category ref table and match up all id's that the the product matches in a prod-id/cat-id x-ref table that would have only those two columns with them set as a compound PK.

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.