1

I have several questions and I hope you guys could help me out. For the record, I'm developing a web application using PHP, CodeIgniter MVC, MySQL, etc.

  1. Can I use MySQL triggers to create notifications? Is it the best way or practice in creating such a feature?
  2. What does "polling" the database actually mean?
  3. What is the best way to mark a certain notification "read" or "seen"? Is it right after a web page showing the notification has been loaded?

1 Answer 1

1

Can I use MySQL triggers to create notifications? Is it the best way or practice in creating such a feature? Yes you can. Whenever a new message comes to your system, you can update the notification table using trigger.

What does "polling" the database actually mean? "polling" is the Technic, to periodically/continuously fetch the data from your database table. This can be achieved using Synchronous AJAX request which can periodically call PHP script to see is there any unread notifications.

What is the best way to mark a certain notification "read" or "seen"? Is it right after a web page showing the notification has been loaded? The best way is to define a flag in your notification table, which will be updated once the user reads the notification.

Sign up to request clarification or add additional context in comments.

2 Comments

What if my notification is about a new event in the website and not about a message? I mean, for example, a new appointment reservation has been submitted? Is MySQL trigger the best way too?
If you are going to create a notification table for all the notifications in your website, trigger will be the best way to update your notification table. Otherwise you can query your event table directly to see If there any new events.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.