An event listener for modifying a MySQL table?

Is there a listener or php / javascript / mysql / ajax method that can call a function every time the data in the MySQL table is changed - for example, when a new row is added or the row is changed / deleted.

Or I look at it from the wrong point of view, I'm still learning AJAX.

Just looking to be directed in the right direction, I could not find anything. Thanks.

Edit Basically, when a user sits on my site, if new data is added to the database on the server from another source (not due to the action of this user), I want to be able to call a function to asynchronously load this new data for this user.

+6
source share
2 answers

If you are trying to change the date in MySQL based on other changes in MySQL, the triggers should work:

http://dev.mysql.com/doc/refman/5.6/en/triggers.html

If you want to have callbacks on the server side or on the client side when changing data in MySQL, then you will not have this ability through MySQL. Most likely, you will need to add something to your scheme (flags, timestamps, etc.), which indicate when the data will be changed and start the asynchronous process in order to do something based on the data change.

+2
source

For this you need to use MySql Proxy

MySQL Proxy is a simple program that is located between your client and the MySQL server.


which can control, analyze or transform their communication. Its flexibility allows for a wide range of applications, including load balancing; fault tolerant; query analysis; query filtering and modification; and much more. Installation and assembly instructions are in the source archive

Or do you need to keep a journal

+1
source

All Articles