0

I have three tables named 1.members – 2.group – 3.membergroup. The relationship between the group and members table is many-to-many, which is defined inside the membergroup table and the membership group of the members in the groups. The membergroup table has two fields, group ID and member ID.

I have a page where I enter the name of the group, the names of the members are also entered, I am considering to first create a record in the group table according to the entered name, then enter the names of the members in the members table. The problem I am facing now is that when I add the new group record in the group database and enter the member names in the members table, I don't know how to fill the membergroup table, because the ID of the new group and the members I don't have it, and if I want to pull out all the information from the database and compare which members belong to the group we are creating, the names may be the same, but the IDs are not. I want to make a state when the operation of creating a new record is done to return the ID of the new record that I put in the third table, that is, membergroup.

This is what came to my mind, what is the official, correct and optimal method of this problem? Thank you for helping me

Robert
  • 85
  • 1
  • 1
  • 6

0 Answers0