Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> MySQL
Author Message
Donovan
Client



Joined: Oct 07, 2003
Posts: 735
Location: Ohio

PostPosted: Thu May 15, 2008 7:20 am Reply with quote

Is this doable?

I am trying to capture the admin who may change grades.

Code:


CREATE TRIGGER irat_grade_after_update AFTER UPDATE ON atlas_tl_session_grades
FOR EACH ROW BEGIN
INSERT INTO atlas_tl_audit_grades SET action='update', Session_ID=OLD.Session_ID, old_raw_grade=OLD.IRAT_RAW, raw_grade=NEW.raw_grade, UID=OLD.UID, changed=NOW(), changed_by = SUBSTRING_INDEX(USER(),'@',1);
END;


From what I have read this

Code:
SUBSTRING_INDEX(USER(),'@',1);


will capture .. [ Only registered users can see links on this board! Get registered or login! ]

I then get everything before the @ and I'm good to go.
 
View user's profile Send private message Visit poster's website ICQ Number
Donovan







PostPosted: Thu May 15, 2008 7:27 am Reply with quote

Or maybe this.

Code:
CREATE TRIGGER irat_grade_after_update AFTER UPDATE ON atlas_tl_session_grades

SELECT @admin_user := SUBSTRING_INDEX(USER(),'@',1);
FOR EACH ROW BEGIN
INSERT INTO atlas_tl_audit_grades;
SET action='update', Session_ID=OLD.Session_ID, old_raw_grade=OLD.IRAT_RAW, raw_grade=NEW.raw_grade, UID=OLD.UID, changed=NOW(), changed_by = @admin_user;
END;
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> MySQL

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©