Jump to content

Tracking Changes


bdmovies

Recommended Posts

Server version: 5.0.41

MySQL client version: 5.0.41

 

I am writing an application and I would like to track changes made to the database. For instance, I add a new client to my clients table. Tomorrow I update the address - I want to be able to track that the phone number was changed, the date it was changed and the user that changed it. (I used the client table for example purposes, generally I don't need this information, but what I do need it for is a tad more in depth, but the concept remains the same).

 

I've done some research, but can't seem to find the most efficient way to do this. I have several tables named history_nameOfTableBeingTracked and they contain id, userId, addressID, changes made, datestamp. (address being something that I'm tracking). Every time a change is made, I write it to the table, where the changes made column contains the SQL that used to make the change. Then I can just use PHP to query that table, interpret the SQL the way I want and display it as something like this "123 Main street: 1/1/2008 - Changed ZIP to 33234"

 

Is this the most efficient way to do this, or can MySQL do it by itself?

 

Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.