I have to create a code in PHP that will allow me to keep the history of record updates in MySQL database so I can find by date an old revision.
Here is the example
There is an open source (MIT license) framework to build CRM and ERP type of database driven web applications. You can download EPESI from http://epe.si/ available also on SourceFroge: http://sourceforge.net/projects/epesi/
EPESI's CRUD engine - the Record Browser - has a very efficient record history as well as other features like advanced permission system (down to a field level) and much more.
A single recordset stores data in as many as 10 tables and it is database agnostic (uses PHPAdoDB). A table called recordset_data stores "raw" data and history of changes is stored in 2 additional tables: recordset_edit_history and recordset_edit_history_data.
Record's edit_history has the following structure:
Record's edit_history_data has the following structure:
It is a very fast and efficient engine and it stores changes not on the record but on a single field level.