criostage Posted August 1, 2011 Share Posted August 1, 2011 Hi, i m doing a small project of mine to learn PHP and MySQL as a hobby, i did some PHP scripts or utilities in the past but never had actually to use an database until now (i only have some experience in creating databases, tables and perform backups and restores on the database), in this project i m trying to do an TV Show database to store and keep track of what i have. I started to write down what i needed to know about an certain show and i came to this list: - Name, Alternative Name, Genre, Relation with other series or seasons, description, number of episodes etc ... and would translate into something like this in tables: ID | Name | AlName | Relation | Description | Episodes | Genre So Far so good, inserting just 1 data field from php to the database isnt that hard, but then since i watch Japanese, Korean and sometimes chinese movies there are a few genre's (especially in japanese Anime) that i would like to store an small description to the term to know what it means so i had to do an 2nd table just for the Genre's (this would help me to insert more genre's to the database later on as well) so the database would be like this: TV Show Table ID | Name | AlName | Relation | Description | Episodes Genre Table ID | Genre | Description My Question is (and sorry for long description ...) whats the best way to store in the database the relation between the 2 tables to say that the TV Show With the ID 10 have the Genre ID 10, 12 and 13? thank you in advance. PS: i dont have any SQL code to show yet since all my "drawing" are all still on paper ... truly sorry about that but if needed i will do the code with what ever i already have. Quote Link to comment https://forums.phpfreaks.com/topic/243490-beginner-looking-for-advice/ Share on other sites More sharing options...
requinix Posted August 1, 2011 Share Posted August 1, 2011 whats the best way to store in the database the relation between the 2 tables to say that the TV Show With the ID 10 have the Genre ID 10, 12 and 13? Use another table. tvshow | genre -------+------ 10 | 10 10 | 12 10 | 13 Quote Link to comment https://forums.phpfreaks.com/topic/243490-beginner-looking-for-advice/#findComment-1250272 Share on other sites More sharing options...
criostage Posted August 1, 2011 Author Share Posted August 1, 2011 whats the best way to store in the database the relation between the 2 tables to say that the TV Show With the ID 10 have the Genre ID 10, 12 and 13? Use another table. tvshow | genre -------+------ 10 | 10 10 | 12 10 | 13 lol damn the solution was pretty simple ... tyvm for your help man =) Quote Link to comment https://forums.phpfreaks.com/topic/243490-beginner-looking-for-advice/#findComment-1250372 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.