mercredi 11 novembre 2020

MySQL trigger result - 1064

i need to create a trigger in sql to do the following: Wordpress Table 'options' has in id 1 and id 2 the option_value URL of the Website.

If that URL gets changed in that particular place (id 1 & id2), the trigger should run to set back to old.option_value

CREATE TRIGGER tr_up_otpions_value
BEFORE UPDATE ON option_value FOR EACH ROW
BEGIN
IF (:old.option_value = 'https://example.com') then
:new.option_value := 'https://example.com';
end if;
end;

but i get the following error:

#1064 - Error ':old.option_value = 'https://example.com') then
    :new.option_value := 'h...' Row 4

Aucun commentaire:

Enregistrer un commentaire