I have the following database relationship:
|--------| |-----------------| |-------|
| Groups | ------- 1.* | GroupMembership | *.1------- | Users |
|--------| |-----------------| |-------|
I have group ids in Groups, user ids in Users and the both of the in group membership, thus making a relationship between groups and users.
One record in GroupMembership looks like:
GroupID | UserID | datetime
I have an array posting from a form that looks like this:
["members"]=> array(5) {
[0]=> "175"
[1]=> "113"
[2]=> "122"
[3]=> "80"
[4]=> "161"
}
Each value (175, 113 etc..) is a user ID. I need to insert a new row into the GroupMembership table for every ID in that array. How does one achieve such a task without kicking the ass out of the database and the servers resources?
Thanks in advance!