I want to do something on my website, but I still dont know how to do it yet. I have two tables in my database, one is called users and the other is called groups.
fields in the first table
userid - firstname - lastname - email - birthday - gender - password - user_level - signup_date - last_login - activated - account_type - account_owner_name - account_routing_number - account_number - shares.
fields in the second table
groupid - groupname - numberofmembers - paymentamount - paymentrounds - email.
When a user CREATE a group, I insert the group’s information in the first table in the same row where his/her information inserted. Also, I send the group’s information plus his/her email address to the second table.
I want to know how to do the following:
- Insert the group’s information when someone ENROLL in the group.
- Select First and Last name of members who are enrolled in the same group.
This is what I tried to do after I made some research.
I created a third table named it users_groups with two fields userid and groupid … I tried to make a relationship between userid in users_groups and userid in users table and the same relation between groupid fields but it didnt work (When I input any data, the users_groups did not update). Note: I changed the engine to InnoDB and choose CASCADE in both delete and update.