Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
CREATE TRIGGER `tarfinizbizde`.`favoriler_AFTER_INSERT` AFTER INSERT ON `favoriler` FOR EACH ROW
BEGIN
UPDATE tarifler
     SET populerlik = populerlik + 1
   WHERE tarifID = NEW.tarifID
END;


When I try this code on my mysql database i got this error "#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'END' at line 5"

What I have tried:

nothing special try deleteing the ;
Posted
Updated 6-Jun-16 19:47pm

Well, near the end of line 5 should be a semicolon (;)
SQL
CREATE TRIGGER `tarfinizbizde`.`favoriler_AFTER_INSERT` AFTER INSERT ON `favoriler` FOR EACH ROW
BEGIN
UPDATE tarifler
     SET populerlik = populerlik + 1
   WHERE tarifID = NEW.tarifID;
END;
 
Share this answer
 
I don't have MySQL running at the moment, but try adding a semicolon at the end of the UPDATE statement:
SQL
   ...
   WHERE tarifID = NEW.tarifID;
END;
 
Share this answer
 
Comments
Member 10525430 7-Jun-16 1:52am    
i got this error"
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5
"
OriginalGriff 7-Jun-16 4:46am    
I've just realised we have spoken before: you are trying to do this on GoDaddy, which doesn't allow MySQL triggers. Hence you get errors when you try to create them.
http://www.codeproject.com/Questions/1105050/Godaddy-mysql-problem

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900