I'm trying to create an Trigger within my MySQL Database, but I always get the 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 '
BEGIN DECLARE tmppl INT; SELECT MAX(PortListID) FROM pj_servers INTO t' at line 2
This is the query. I just can't find the error.
CREATE TRIGGER init_new_server AFTER INSERT ON pj_servers
BEGIN
DECLARE tmppl INT;
SELECT MAX(PortListID) FROM pj_servers INTO tmppl;
INSERT INTO pj_servers (Registered, PortListID)
VALUES (Current_Timestamp, (tmppl+1))
WHERE pj_servers.ID = NEW.ID;
INSERT INTO pj_serverports (PortList, Port, isOpen, Script)
VALUES (tmppl+1, 80, TRUE, "say(\"Hallo\"");
END$$