At 06:57 28/10/2007, you wrote:
Message-ID: <[EMAIL PROTECTED]>
Date: Sun, 28 Oct 2007 14:56:12 +0800
From: Ronald Wiplinger <[EMAIL PROTECTED]>
I need some hints how to do that. Maybe there is a template or an
easy function available.
I have a MySQL database with some tables. Everytime a table record
changes, I want also put the old record to a history database.
The history table and the original only differs that the key of the
original will be just a field in the backup, while the new key is
now the UNIX time stamp.
How can I do that "easy"?
"Easy" is to set a MySQL5 trigger which does the Insert on update :
eg (from the manual page) :
CREATE TRIGGER testref BEFORE INSERT ON test1
FOR EACH ROW BEGIN
INSERT INTO test2 SET a2 = NEW.a1;
DELETE FROM test3 WHERE a3 = NEW.a1;
UPDATE test4 SET b4 = b4 + 1 WHERE a4 = NEW.a1;
HTHCheers - Neil
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php