Jump to content

Recommended Posts

If I am using  the same script "add_catagory.php" and there are ten different catagories like "apples, oranges, strawberries, etc... " and it is uploading to MySQL and a table I'll call "uploads" and uploads has about 8 fields like "name, type, region, age, color, etc..." would you make a separate MySQL database for each category or have them all upload to one database?  Thanks in advance  ;D

 

Alex

Link to comment
https://forums.phpfreaks.com/topic/89650-php-script-uploading-to-mysql-tables/
Share on other sites

Is there a reason why it's better to have it uploaded to one database and not keep each category separate?  Does it make the site more efficient with searching and things like that?  Any feedback would really be great.  I'm about to link my newly designed database to my site.

I'm guessing by "database" you actually mean "table". So you would have 1 table called "apples" and 1 called "oranges" etc etc.

This is ALL wrong. Your logical division be as follows:

 

Table: fruit_categories

fields: cat_id, cat_name

 

This table will contain "apples", "oranges", "strawberries"

e.g.

1 "apples"

2 "oranges"

3 "strawberries"

 

Table: fruit

fields: name, region, age, color, CATEGORY!!!!

 

The category field is a foreign key to the fruit_categories table

 

This will contain

"granny smith", "cornwall", "18", "green", 1

"cox", "yorkshire", "2", "red", 1

 

See how it relates now?

I think you need a 101 in database normalisation ;)

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.