mostafatalebi Posted August 28, 2013 Share Posted August 28, 2013 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 Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted August 28, 2013 Share Posted August 28, 2013 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. Quote Link to comment Share on other sites More sharing options...
mostafatalebi Posted August 28, 2013 Author Share Posted August 28, 2013 No it's not tag. it is category. as strong as category. Just the way I displayed conveyed the tag. No, it is category and I know what's their difference. thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.