I am trying to build an email sender in PHP/MySQL where you can choose the group of people (in dropdown menu) and send them a message. I have a {users} table with emails and I am having trouble figuring out how to do groups table.
What columns should I have? or Any other way to do the same thing?
I would be really grateful if you could explain like you would to a beginner :)
Thank you)
You're looking for a many-to-many relationship, which will look something like this (three tables):
group
id
name
user_groups
id
user_id
group_id
users
id
name
email
Whenever a user is added to a group, you will insert a row into the user_groups
table.
Have a read on Database Normalization .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.