I've got a basic CRUD application that is running just fine. I want to add an entry to a log when something changes -- someone adds a record, for example.
When someone updates an existing record, I want the log to show only what changed. For instance, I've got the following fields:
Name
Address
City
State
Zip
So if the address changes (and ONLY the address), I'd like the log to say:
'Address changed from YYY to ZZZ'
Here's my current statement to write the log. What do I need to change?
INSERT log SET user_id = '$logid', username = '$logname', usertime = '$logdate', ipaddress = '$_SERVER[REMOTE_ADDR]', action = 'update', name = '$name', address = '$address', city = '$city', state = '$state', zip = '$zip'