|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
dear all,
i'm newbie using trigger, but i need to create trigger to me audit a table. i'm using mysql 5 in xampp. i need to store php session data in log table. i have try to define it when create trigger. this is my code: ==== DELIMITER $$ DROP TRIGGER /*!50033 IF EXISTS */ `sample_audit`$$ CREATE TRIGGER `sample_audit` BEFORE UPDATE on `sampel_name` FOR EACH ROW BEGIN DECLARE mychanged INT DEFAULT 0; IF NEW.name != OLD.name THEN INSERT INTO sampel_name_audit SET fld_name = 'name', chg_by = '$_session[user_email]', /* just what i want to store */ chg_ip = '$_server[remote_addr]', /* just what i want to store */ oldval = OLD.name, newval = NEW.name; END IF; END$$ DELIMITER ; ==== the problem is, when i see the log table, column chg_by and ch_ip still empty. it doesn't filled by $_session[user_email] nor ip. how to make it? thanks. rm |
|
![]() |
| Outils de la discussion | |
|
|