mysql - PHP Many to Many Set Ids -
For the purpose of this question, suppose we have many relationships to use three tables: In the syllabus, with courses and name enrollment with students of ID and name - course_id and student_id
In the train, Code> course.student_ids = [1,2,3,4,5]
And the railroad says that it will add / remove the ID as necessary. I want to do something similar in PHP. Something like this
set_courses ($ student_id, array (1,2,3,4,5)); What was I thinking that if PHP is a good way to implement it efficiently, then I have 3 questions (to get an existing ID, to remove an unnecessary people, and I can think of a way to add a new people. Is there a way to do this in one or two questions?
Thank you!
If I understand you correctly, then you can do it in 2:
Insert enrollment I use the transaction, though to ensure that both are executed
Comments
Post a Comment