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