I have this MYSQL EVENT which I can't understand why it not works. It shows me an error saying "Sorry an unexpected error happened!" on phpmyadmin when I'm trying to execute it. Please someone tell me what is wrong with this code.
DELIMITER //
CREATE EVENT salary_add
ON SCHEDULE EVERY 24 HOUR
DO
BEGIN
DECLARE month_end DATETIME;
SET month_end = LAST_DAY(DATE(NOW()));
DECLARE today DATETIME;
SET today = DATE(NOW());
DECLARE reg_id VARCHAR(6);
DECLARE sal INT(8);
IF month_end=today THEN
SELECT register_id INTO reg_id, salary INTO sal FROM employees
WHERE status ='1';
INSERT INTO tbl_salary values register_id=reg_id,amount=sal,salary_date=today,status='0';
END IF;
END//
DELIMITER ;