Jump to content

Beginner looking for Advice


criostage

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/243490-beginner-looking-for-advice/
Share on other sites

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

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 =)

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.