Let's say we got two tables.
First table is items - id, title.
Second table is history - id, title, action, user.
We can have following AFTER INSERT trigger for "This user inserted this item":
INSERT INTO history (title, action, user) VALUES (NEW.title, 'INSERT', @phpUserId);
If I want to insert new item, I can do something like this.
SET @phpUserId = 123;
INSERT INTO items (title) VALUES ('My best item');
In this case, trigger works perfectly.
But the problem is, when I add some text into variable - for example SET @phpUserId = "library123"; - In this moment the trigger is not able to take that variable.
Any ideas why only integer variables are passed?
SET @phpUserId = 'library123';