我已经编写了一个插入前触发器,如果'rating'>这些触发器不会在表格中插入数据5并将其插入表'rating_check'并带有消息。对于'rating'< = 5,数据将插入所有表中。但它不起作用,我也没有收到任何错误。这是触发代码 -
DELIMITER $$
CREATE
TRIGGER `mytrigger` BEFORE INSERT
ON `review`
FOR EACH ROW BEGIN
IF NEW.ratings > 5 THEN
SET @trigger_desc = 'You cannot rate greater than 5!';
INSERT INTO `rating_check` (`trig_id`, `trigger_desc`) VALUES ('', @trigger_desc);
ELSE
INSERT INTO `developer_details` (`developer_id`,`developer_name`,`developer_email`) VALUES ('$appDevId','$appDevName','$appDevEmail');
INSERT INTO `apps` (`app_id`,`app_name`,`app_icon`,`dev_id`) VALUES (LAST_INSERT_ID(),'$appName','$appIcon','$appDevId');
INSERT INTO `app_details` (`app_id`,`description`,`version`,`release_date`,`size`) VALUES (LAST_INSERT_ID(),'$appDesc','$appVersion','$appDate','$appSize');
INSERT INTO `app_specs` (`app_id`,`downloads`,`category_name`) VALUES (LAST_INSERT_ID(),'$appDownloads','$appCategory');
INSERT INTO `review` (`app_id`,`ratings`) VALUES (LAST_INSERT_ID(),'$appRatings');
END IF;
END$$
'trig_id'在这里自动递增。请帮帮我!