DB Table changes notification

Started by plccourses, Sep 17, 2022, 01:09 AM

Previous topic - Next topic

plccoursesTopic starter

Greetings.

There is a database table that contains data of all the participants, both new and old. An administrator is responsible for monitoring any changes made to the table in real-time. This includes not only the appearance of new records but also their modifications. Whenever the data in the table changes, the administrator receives an alert.

To keep track of any changes made to the table, a timer can be added to JS while on the tracking page. Subsequently, a request is sent via ajax to check if there has been any modification or addition of data.

One way of checking for changes is to use SELECT to enter all records from the table into an array. After each request, the new data is compared with the old one stored in arrays. However, is there a query that signifies that the "previous query" does not match the last query, indicating a change in the table?

Perhaps a comparison between all the old data and the new ones is necessary to track any changes made to the table.
  •  

mickyrobert

To keep track of changes made to the table, one can save the time of the last creation and update of the record. The time of the last http request is also stored in JS. This enables the retrieval of records created or modified after the last request from the database.

At the end of the program, Misqli closes itself. To enable the server to send something, the use of long polling may be necessary. This entails digging in that direction.
  •