1
我試圖創建一個觸發器,在布爾型字段驗證後插入表中。這裏是我的代碼:在PhpMyAdmin中創建觸發器會導致語法錯誤
DROP TRIGGER IF EXISTS user_au_trg;
DELIMITER $$
CREATE OR REPLACE TRIGGER user_au_trg
AFTER UPDATE ON users
FOR EACH ROW
BEGIN
IF NEW.UserNameVerified = '1'
INSERT INTO changeLog(logId,userId,logDate, theLog) VALUES (null, new.UserId, NOW(), 'User Has Now Been Verified')
END IF
END $$
DELIMITER ;
每當我嘗試運行此,我得到一個語法錯誤:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INSERT INTO changeLog(logId,userId,logDate, theLog) VALUES (null, new.UserId, NO' at line 6
我在做什麼錯誤是造成這個錯誤?
我還是不明白什麼是錯 – luffy
你是說我的說法錯誤?如果是這樣,你可以發佈錯誤嗎?如果不是你能突出哪一部分你不明白,我會加強我的答案澄清這一點。謝謝 –
啊謝謝我一開始沒有看到變化。謝謝你的工作 – luffy