Jump to content

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

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.