0

I tried to create trigger AFTER UPDATE via phpmyadmin with body INSERT:

BEGIN
INSERT INTO updatespersonal SET (user, time, type, operator) VALUES (NEW.idDetailToUsers, CURRENT_TIMESTAMP(), "detailtousers", "update");
END

But I get error, reason that I can not understand:

1064 on line 2

May be problem in double quotes?

1
  • 1
    share the error message Commented Jul 10, 2015 at 12:04

3 Answers 3

4

Error in Insert Statement, remove SET keyword:

INSERT INTO updatespersonal (user, time, type, operator) VALUES (NEW.idDetailToUsers, CURRENT_TIMESTAMP(), "detailtousers", "update");
Sign up to request clarification or add additional context in comments.

Comments

1

Your syntax is incorrect. You no need SET when using INSERT INTO.

Your code should be:

BEGIN
INSERT INTO updatespersonal (user, time, type, operator) VALUES (NEW.idDetailToUsers, CURRENT_TIMESTAMP(), "detailtousers", "update");
END

1 Comment

Yea, you posted few seconds faster, because you posted only code with deleted word SET without description, while I wrote description why It not working and provided link to documentation.
0

2 issues

  1. In Insert INTO no need of SET
  2. You are using a key word as column name user. enclose it in ""

    BEGIN INSERT INTO updatespersonal ("user", time, type, operator) VALUES (NEW.idDetailToUsers, CURRENT_TIMESTAMP(), "detailtousers", "update"); END

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.