我需要的是为一个论坛中的所有新线程添加默认前缀。
我尝试在 php admin 中创建触发器
这是代码:
CREATE TRIGGER set_thread_prefix BEFORE INSERT ON mybb_threads
FOR EACH ROW SET NEW.prefix=46
1142 - 对于表“mybb_threads”,用户“xxx”@“localhost”的触发命令被拒绝
该论坛在 altervista 举办。
最佳答案
好的,触发器应该如下所示。你有 else if
但在 mysql 中 elseif
之间没有空格
delimiter //
create trigger set_thread_prefix before insert on mybb_threads
for each row
begin
if new.fid = 46 then
set new.prefix = 2;
elseif new.fid = 49 then
set new.prefix = 3;
elseif new.fid = 54 then
set new.prefix = 4;
end if;
end ;//
delimiter ;
关于mysql - mybb 如何为某些论坛设置默认前缀向 mybb_threads 表添加触发器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27267877/