If someone could point me in the right direction, I would be grateful. I have spent the past three weeks to solve this, and I am stumped.
I am doing a database for ordering model cars off the Internet. The database is set up in MYSQL.
There are two tables each with a primary key.
Table 1: Car Model
Modelid Modelname
Table 2: Car Color
Colourid Colourname
One Car Model can have many Car Colours (Red, Blue, Yellow)
In MYSQL I set up a Third Table called ModelColour where the three fields are:
Table 3: ModelColour
Incrementing Primary Key Modelid Colourid
A car can come in about 15 colours, but there are approximately 75 different colours available.
I'd like to have all 75 colours done in checkbox form, so the person entering the car information can choose 15 colours at once, rather than entering the same car information in each time, but changing the colour 14 more times.
In effect, every time a box is checked on the FORM, it would store a separate record and thus, without refreshing the page, Table 3 would look like this:
Table 3: ModelColour
Incrementing Primary Key Modelid Colourid
------------------------ ------- --------
1 Model1 111
2 Model1 112
3 Model1 113
My question is, is this possible in my current set up?
Or should I do a separate table for each of the 75 colours and use a on/off switch for each field?
Thanks for any help and your patience if this is a much discussed topic that I have overlooked.
Joel
I am doing a database for ordering model cars off the Internet. The database is set up in MYSQL.
There are two tables each with a primary key.
Table 1: Car Model
Modelid Modelname
Table 2: Car Color
Colourid Colourname
One Car Model can have many Car Colours (Red, Blue, Yellow)
In MYSQL I set up a Third Table called ModelColour where the three fields are:
Table 3: ModelColour
Incrementing Primary Key Modelid Colourid
A car can come in about 15 colours, but there are approximately 75 different colours available.
I'd like to have all 75 colours done in checkbox form, so the person entering the car information can choose 15 colours at once, rather than entering the same car information in each time, but changing the colour 14 more times.
In effect, every time a box is checked on the FORM, it would store a separate record and thus, without refreshing the page, Table 3 would look like this:
Table 3: ModelColour
Incrementing Primary Key Modelid Colourid
------------------------ ------- --------
1 Model1 111
2 Model1 112
3 Model1 113
My question is, is this possible in my current set up?
Or should I do a separate table for each of the 75 colours and use a on/off switch for each field?
Thanks for any help and your patience if this is a much discussed topic that I have overlooked.
Joel
Comment