search

Home  >  Q&A  >  body text

How to save notifications for multiple users in phpmysql database without overloading the database with records

I'm concerned that I could easily create a crawl in the database while trying to ensure that all users in the database can view the same messages. The problem is that I need to be able to send a message from my admin area and have all users receive notifications and also have the option to mark the message as read. I know I should create two tables but how to write sql commands to generate messages for all users becomes frustrating. This may be a simple task but I need help

I try to create two tables in my database. Notification and has__notify. Notification holds the message along with its title and creation date, 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 as I'm already a bit confused.

P粉068174996P粉068174996264 days ago547

reply all(1)I'll reply

  • P粉015402013

    P粉0154020132024-03-31 17:44:49

    By default, the table is never locked during inserts. If you want to make sure the data is stored, you can use transactions.

    reply
    0
  • Cancelreply