Mysql 插入phpmyadmin上的触发器
我是MySQL新手。我有两张表,分别是帖子和通知。我试图为帖子中添加的每一个新行创建一个触发器,我想将该新行添加到通知id中。 它在mysql上正常工作,但在phpmyadmin中触发器不会执行,它给出了一个错误 1064-您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,以了解要使用的正确语法 在第11行的“”附近 下面是我的桌子的样子: 员额表Mysql 插入phpmyadmin上的触发器,mysql,tsql,phpmyadmin,mysql-workbench,Mysql,Tsql,Phpmyadmin,Mysql Workbench,我是MySQL新手。我有两张表,分别是帖子和通知。我试图为帖子中添加的每一个新行创建一个触发器,我想将该新行添加到通知id中。 它在mysql上正常工作,但在phpmyadmin中触发器不会执行,它给出了一个错误 1064-您的SQL语法有错误;检查与您的MySQL服务器版本对应的手册,以了解要使用的正确语法 在第11行的“”附近 下面是我的桌子的样子: 员额表 create table posts ( id int, topic_id tinyint, post_creator int, p
create table posts
(
id int,
topic_id tinyint,
post_creator int,
post_date datetime,
post_content text
);
通知表
create table notification
(
not_id int ,
top_id tinyint,
p_creator int,
p_date datetime,
p_content text
);
通知id触发器
delimiter $$;
create trigger notification_id before Insert on posts
for each row
begin
declare id int;
declare topic_id int;
declare post_creator int;
declare post_date datetime;
declare post_content text;
insert into notification(not_id,top_id,p_creator,p_date,p_content) values(new.id,new.topic_id,new.post_creator,new.post_date,new.post_content);
end$$;
分隔符$$代码>
所以要明确的是,您已经创建了触发器,当您从MySQL执行插入时,它工作正常,但是从phpMyAdmin执行相同的插入失败,并显示错误消息?您是通过“插入”选项卡插入还是直接在SQL中键入?