Jump to content

store php session when define trigger


meisaputra

Recommended Posts

dear freakers,

 

i need to store php session in log table triggered by changes of the field.

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[username]',

oldval = OLD.name,

newval = NEW.name;

END IF;

END$$

DELIMITER ;

====

 

the problem is, when i see the log table, column chg_by consist 0.

it doesn't filled by $_session[username]. how to make it?

thanks.

 

rm

 

Link to comment
https://forums.phpfreaks.com/topic/72440-store-php-session-when-define-trigger/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.