Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
82 views
in Technique[技术] by (71.8m points)

php - How can I keep record of changes after an update in a table in mysql?

Im importing a csv file into a sql table, from there it is ok. Im also updating a column called date, so everytime an user import a file it also updates the date. But the problem is that the user needs to upload a file every month and I need to keep track of every upload into the table. I do not know how to do it. Can somebody give me a hint?

question from:https://stackoverflow.com/questions/65891910/how-can-i-keep-record-of-changes-after-an-update-in-a-table-in-mysql

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you don't need to know changes in the file you can just use a column with an update date (you can use triggers for this or edit your column like: `tm` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP). You could also store a number of "edit times" to see if it's the same as the number of months since the creation of the row. Otherwise, you should write a new row for every update and keep track of the user by an ID.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...