Jump to content

[SOLVED] mysql tables


anth0ny

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/137203-solved-mysql-tables/
Share on other sites

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)

Link to comment
https://forums.phpfreaks.com/topic/137203-solved-mysql-tables/#findComment-716719
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/137203-solved-mysql-tables/#findComment-716744
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.