alexinjamestown Posted February 6, 2008 Share Posted February 6, 2008 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 Alex Quote Link to comment https://forums.phpfreaks.com/topic/89650-php-script-uploading-to-mysql-tables/ Share on other sites More sharing options...
Looktrne Posted February 6, 2008 Share Posted February 6, 2008 One Quote Link to comment https://forums.phpfreaks.com/topic/89650-php-script-uploading-to-mysql-tables/#findComment-459329 Share on other sites More sharing options...
alexinjamestown Posted February 6, 2008 Author Share Posted February 6, 2008 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. Quote Link to comment https://forums.phpfreaks.com/topic/89650-php-script-uploading-to-mysql-tables/#findComment-459337 Share on other sites More sharing options...
Looktrne Posted February 6, 2008 Share Posted February 6, 2008 it would be way more efficient in one because it one have to keep on connecting to a different database... the database is designed to do this inside of one database http://www.tizag.com/mysqlTutorial/mysqlquery.php Quote Link to comment https://forums.phpfreaks.com/topic/89650-php-script-uploading-to-mysql-tables/#findComment-459706 Share on other sites More sharing options...
sasa Posted February 6, 2008 Share Posted February 6, 2008 are you talking abouth databases or tables? Quote Link to comment https://forums.phpfreaks.com/topic/89650-php-script-uploading-to-mysql-tables/#findComment-459712 Share on other sites More sharing options...
aschk Posted February 6, 2008 Share Posted February 6, 2008 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 Quote Link to comment https://forums.phpfreaks.com/topic/89650-php-script-uploading-to-mysql-tables/#findComment-459714 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.