I'm focusing on an internet based application using Zend framework.

I'm searching for a method to keep good reputation for updates designed to a lot of posts.

Use-situation: User can also add a product with 5 qualities. The consumer is permitted to update the five qualities. I have to track all of the updates he makes to individuals 5 qualities.

On way I figured of was adding a brand new table named log which stores that old value, new value, column title, itemID and timestamp.

What's the easiest method to do that? What are the existing techniques/options/good examples ?


What you are most likely searching for is definitely an audit log. You may create one using Triggers in your MySQL database.

A good example of how to get this done is here now: http://ronaldbradford.com/blog/auditing-your-mysql-data-2008-07-15/

Inside your comment below you added the database isn't 'fixed'. For the reason that situation, you'd need to replicate any alters towards the table to ensure that they're put on the audit table in a way that any recently added posts are put into the log too.

You can look at logging this inside your application (as the tags selected with this question appear to suggestion) - but bear in mind this means there might be situations where your log doesn't supply the complete answer. Triggers, saved methods and then any manual interventions within the database won't be drenched... so be cautious if you opt to go lower that path.

Triggers are the most typical method of doing auditing and also the only really reliable method to capture that which was done whether done in the interface or elsewhere. They are doing vary by database in the way they could be written though. Knowing the potential kinds of database backends you'll support, you can write separate triggers for every.

Should you must handle this without triggers, your best choice is to possess a procedure that creates towards the audit table in addition to helps make the update change. It may be complex enough to warrant a saved proc known as through the Zend framework instead of depending around the framework itself to complete. (I am not familair with Zend so I'm not sure if this sounds like something that may be setup, I understand a saved proc could handle this.)