What is the best way to store user notifications in MySQL?

nikmav

I am building a noticeboard module in a php/mysql app. The idea is an admin can post notices to a single user, groups of users (by role), perhaps combinations of users/groups/roles, everyone in the system.

My initial thoughts were to have the following schema which solves my send to a single user or single user role:

notices
----------------
notice_id
notice_date
notice_title
notice_text
notice_recipients  <-- linked to user_role_id (from user_roles table)

I'm not sure how to record 2 groups and/or 50 individual recipients without having duplicated rows in the database. Is it possible to store all the user_role_id's in the one notice_recipients field and then somehow read the contents of that field to display in each individual users noticeboard?

Eugen Rieck

You need a join table:

notices
----------------
notice_id
notice_date
notice_title
notice_text

and

notices_users
----------------
notice_id
user_id

When you create a notice, write it to the notces table. Then for every user, that should receive it, add a row to notices_users. If you have shown it, either delete it from notices_users or add a status field.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

What is the best way to store a user feature?

From Dev

What is the best way to store a user feature?

From Dev

what is the best way to store an array in mysql ?

From Dev

best way to store Google user-ID value in mysql and java

From Dev

What is the best way to store a pretty large JSON object in MySQL

From Dev

What is the best way to store special characters in a MySQL database?

From Dev

What is the best way to store multiple entries / arrays on MYSQL table

From Dev

Best way to store user settings

From Dev

Best way to get the todays notifications for each user

From Dev

What is the best way to locally store and quickest way to retrieve app user settings/preferences?

From Dev

Best way to store user's avatars

From Dev

Using Angular what would be the best way to store whether a user has previously checked a checkbox and then recall it?

From Dev

What is the best way to have a subscribers feature? Should I store that list of subscriptions/subscribers under the user or the subscribed page?

From Dev

What is the best place to store user configurations settings

From Dev

What is the best way to store a date/time in JSON?

From Dev

What is the best way to store data in Python?

From Dev

What is the best way to store Symfony project on github?

From Dev

What is the best way to store Date in savedInstanceState?

From Dev

What is the best way to use the React Redux Store?

From Dev

What is the best way to store data in Python?

From Dev

What is the best way to store a set of strings

From Dev

What is the best way to store the image in the memory of app?

From Dev

What is the best way to store datetime value in documentdb?

From Dev

What's the best way to store an id in local?

From Dev

What is the best way to store collections in the local folder?

From Dev

What is the best way to store a list of dates

From Dev

Best way to store a lot of data with timestamp in MySQL

From Dev

mysql - best way to store multiple values

From Dev

Best way to store MySQL login information in Java

Related Related

  1. 1

    What is the best way to store a user feature?

  2. 2

    What is the best way to store a user feature?

  3. 3

    what is the best way to store an array in mysql ?

  4. 4

    best way to store Google user-ID value in mysql and java

  5. 5

    What is the best way to store a pretty large JSON object in MySQL

  6. 6

    What is the best way to store special characters in a MySQL database?

  7. 7

    What is the best way to store multiple entries / arrays on MYSQL table

  8. 8

    Best way to store user settings

  9. 9

    Best way to get the todays notifications for each user

  10. 10

    What is the best way to locally store and quickest way to retrieve app user settings/preferences?

  11. 11

    Best way to store user's avatars

  12. 12

    Using Angular what would be the best way to store whether a user has previously checked a checkbox and then recall it?

  13. 13

    What is the best way to have a subscribers feature? Should I store that list of subscriptions/subscribers under the user or the subscribed page?

  14. 14

    What is the best place to store user configurations settings

  15. 15

    What is the best way to store a date/time in JSON?

  16. 16

    What is the best way to store data in Python?

  17. 17

    What is the best way to store Symfony project on github?

  18. 18

    What is the best way to store Date in savedInstanceState?

  19. 19

    What is the best way to use the React Redux Store?

  20. 20

    What is the best way to store data in Python?

  21. 21

    What is the best way to store a set of strings

  22. 22

    What is the best way to store the image in the memory of app?

  23. 23

    What is the best way to store datetime value in documentdb?

  24. 24

    What's the best way to store an id in local?

  25. 25

    What is the best way to store collections in the local folder?

  26. 26

    What is the best way to store a list of dates

  27. 27

    Best way to store a lot of data with timestamp in MySQL

  28. 28

    mysql - best way to store multiple values

  29. 29

    Best way to store MySQL login information in Java

HotTag

Archive