So I'm trying to write some triggers to help synchronize account information between my master account database and a secondary database where I keep information for radius accounts. My SQL syntax sucks, and I don't have much luck reading the docs on the site (I might have a learning disability...undiscovered as of yet)...so if anyone could spot what I'm doing wrong I'd be very grateful. Trigger is included, and I've included the error message that SQLyog spits out when I try to add the trigger...
I've documented my steps, so hopefully it doesn't look like complete horses&*^, and thanks for any help anyone can offer. TRIGGER = radius_modify (pretty much the same trigger as another one called radius_insert...which triggers on INSERTs) =================== DELIMITER $$; DROP TRIGGER `vexim`.`radius_modify`$$ CREATE TRIGGER `vexim`.`radius_modify` AFTER UPDATE on `vexim`.`users` FOR EACH ROW BEGIN # Check if the accout is enabled, *and* allowed dialup access IF NEW.enabled = 1 AND NEW.on_dialup = 'on' THEN # First insert them into the radius user account table ( radius.radcheck) INSERT INTO radius.radcheck (id,UserName,Value) VALUES (NEW.user_id, NEW.localpart,NEW.clear); # Then insert them into the radius group table (radius.usergroup), group is always 'dynamic' INSERT INTO radius.usergroup(id,UserName,GroupName) VALUES ( NEW.user_id,NEW.localpart,'dynamic'); # Otherwise, if they're not enabled, *or* they're not allowed dial-up access... ELSE IF NEW.enabled = 0 OR NEW.on_dialup = 'off' THEN # Remove them from the radius user account table if they're there... DELETE FROM radius.radcheck WHERE id = OLD.user_id; # and remove them from the radius group table if they're there. DELETE FROM radius.usergroup WHERE id = OLD.user_id; END IF; END$$ DELIMITER ;$$ My error message: ============== Error Code : 1360 Trigger does not exist (0 ms taken) Error Code : 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 17 (16 ms taken) ============================ Regards, Andre Turpin Sysadmin, New North Networks Inuvik, NT, CA