'How do i save notifications in phpmysql database for several users without overloading my database records
I fear that i can easily create reptition in my database while trying to ensure that all users in my db can view the same message. The problem is i need to be able to send from my admin area a message and have all users get notified and also have the option to mark messages as read. i know i ought to create two tables but how to write the sql command to generate the message for all users is becoming frustrating. this might probably be one easy task but i need help
i tried creating two tables in my Db. Notification and has__notify. the notification saves the message with its title and date created while (has__notify) on the other hand contains columns like notificationID(foreign key), userID(foreign key)- to know which user has read the message, dateRead. however, i think my implementation is wrong cause, i am a bit confused already.
Solution 1:[1]
By default a table would never be locked during insert. If you want be sure that data was stored you can use a transactions.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Voxxii |
