我必须在 PHP 中创建一个代码,让我可以在 MySQL 数据库中保留记录更新的历史记录,以便我可以按日期查找旧版本.
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.
这是我实际想要实现的示例:http://en.wikipedia.org/w/index.php?title=突尼斯&action=历史
Here is the example of what I actualy want to achive: http://en.wikipedia.org/w/index.php?title=Tunisia&action=history
这些数据主要是我们为生成报告和提取指数而记录的有关公司的数字.
The data are mostly Numbers that we record about the company to generate reports and to extract indices.
我计划使用 codeigniter,因为它很简单,我正在寻找有关使用相同方法在数据库中保留修改历史的框架或开源项目的想法.
I plan to use codeigniter for it's simplicity and I'm looking for idea about a framework or an opensource project that use the same approach to keep history of modifications in the database.
最简单的解决方案(取决于您的具体需求)可能是在您的表中添加一个 on update/insert/delete 触发器,这样您就可以执行额外的日志记录插入/更新/删除数据时.这样即使是对数据库的手动干预也将被覆盖......
The easiest solution (depending on your specific needs) would probably be to add an on update/insert/delete trigger to your table, so you can perform extra logging when data is inserted/updated/deleted. That way even manual interventions on the db will be covered...
检查 http://dev.mysql.com/doc/refman/5.1/en/triggers.html 了解更多信息.
Check http://dev.mysql.com/doc/refman/5.1/en/triggers.html for more information.
这篇关于如何在 MySQL 中保留记录更新的历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!