"UPDATE `trading` SET `flag`='1', `price_end`='$price' WHERE `time_end` <= '$time' AND `flag`='0'"
CREATE TRIGGER `update_balance` AFTER UPDATE ON `trading`
FOR EACH ROW BEGIN
IF (NEW.`line` = 'up' AND NEW.`price_end` > NEW.`price`) THEN
BEGIN
UPDATE `clients` SET `balance` = `balance` + NEW.`sum` * 1.85 WHERE `email` = NEW.`user_id`;
END
ELSE IF (NEW.`line` = 'down' AND NEW.`price_end` < NEW.`price`) THEN
BEGIN
UPDATE `clients` SET `balance` = `balance` + NEW.`sum` * 1.85 WHERE `email` = NEW.`user_id`;
END
END
END;
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