Choose to insert a value to the database account: you have 20 options and 5 options. Class: only one class can be selected. Then these five subjects and classes will be written into the database. It is to implement such a simple function, although I made it, but I think it is not appropriate. Now I divide my subjects and classes into two tables. It is equal to two insert statements. the IDs of the two insert statements are AUTO_INC values.
Subjects: there are 20 options, and you can select 5.
Class: only one class can be selected.
Then these five subjects and classes will be written into the database. It is to implement such a simple function, although I made it, but I think it is not appropriate.
Now I divide my subjects and classes into two tables. It is equal to two insert statements. the id of the two insert statements is AUTO_INCREMENT. Therefore, in theory, their corresponding id should also be able to match the number. But this is obviously unreasonable.
Second, in this case, the 20 values are actually written into the insert section, but the values are written into the selected values, and those that are not selected are left blank. Then all the output results are output to all the 20 values, but some are empty. so at last, only five values are output, but 20 values are actually output, the other 15 are empty.
PHP code
------ Solution --------------------
I don't quite understand your needs. if I do this, I will build a Cortana.
If this parameter is selected, the id of the subject is saved as a string, for example, 1, 2, and 3. the selected class also saves the same table.
Show select * from subject where id in (1, 2, 3) when selecting a subject)
------ Solution --------------------
Three tables:
Cool:
Id
Name
Class:
Id
Name
Optional table:
Id
Account ID (account id eg: 1, 2, 3)
Class ID (saved class id)