anth0ny Posted December 16, 2008 Share Posted December 16, 2008 Hi i dont know if anyone wants to help but it would be appreciated. I'm about to setup a database was going to do it as the categories as the table names, but someone mentioned setting the categories in there own table and linking them with a category_id If anyone can give me any pointer I would be a very happy chap thanks Quote Link to comment https://forums.phpfreaks.com/topic/137203-solved-mysql-tables/ Share on other sites More sharing options...
Maq Posted December 16, 2008 Share Posted December 16, 2008 What do you mean help? Could you give more detail? You should read up on database normalization. So far, all I can help you with is what the categories table should look like: categories -------------- cat_id => auto_increment cat_name => var_char(50) Quote Link to comment https://forums.phpfreaks.com/topic/137203-solved-mysql-tables/#findComment-716719 Share on other sites More sharing options...
anth0ny Posted December 16, 2008 Author Share Posted December 16, 2008 yeah thats cool, thats was what i thought. So far so good. The bit that i'm unsure of is how would i link the products to the categories, would the products also contain a cat_id? Quote Link to comment https://forums.phpfreaks.com/topic/137203-solved-mysql-tables/#findComment-716736 Share on other sites More sharing options...
Maq Posted December 16, 2008 Share Posted December 16, 2008 I personally use a products_to_cats table. With just 2 fields. Product_id and cat_id. But you could have the cat_id in the products table although I think that wouldn't be fully normalized. So you have 3 tables (I think this is normalized: Products -id -name -price -cost ... Categories -id -name -parent ... Products_to_cats -prod_id -cat_id Quote Link to comment https://forums.phpfreaks.com/topic/137203-solved-mysql-tables/#findComment-716744 Share on other sites More sharing options...
anth0ny Posted December 16, 2008 Author Share Posted December 16, 2008 ok thanks very much I should have enough to go on. Your help is very much appreciated Quote Link to comment https://forums.phpfreaks.com/topic/137203-solved-mysql-tables/#findComment-716762 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.