This is not really a question, it more a list of requirements and you asking for some code so save you trying to do it. I suggest that you read the FAQ on how to ask questions on this forum as it will guide you towards asking questions that you are more likely to get solutions to.
As for your problem, what about using Triggers on the database.
Mysql Triggers[
^]
You could set up a trigger on every table in your database to update a log table with any changes. Personally I think it is over kill to have to monitor EVERY table.
But without knowing your database design it is not easy to advise. I also cannot see a reason for needing this sort of monitoring?
An alternative to the triggers, is that each time your application saves data, it writes an entry to the log table and you just poll the log table on a regular basis to see if there are new entries. Again, this removes the need to monitor every table but just monitor 1.