gmc1103 Posted September 28, 2016 Share Posted September 28, 2016 Hi I have received a lot of records to put in a table but i need to add into a relational table too and the easier is to create a trigger for that. I have this trigge DELIMITER $$ USE `esmaior_biblioteca`$$ DROP TRIGGER /*!50032 IF EXISTS */ `alunos`$$ CREATE TRIGGER `alunos` AFTER INSERT ON `alunos` FOR EACH ROW BEGIN INSERT INTO `aluno_turmas` (id_aluno, id_turma) VALUES (new.id_aluno, 38); END; $$ DELIMITER ; when i use this syntax to insert into the main table INSERT INTO alunos (processo,nome,email,estado) VALUES ('17185','XXXXXXXXXX','','1'); INSERT INTO alunos (processo,nome,email,estado) VALUES ('27051','XXXXXXXXXX','','1'); INSERT INTO alunos (processo,nome,email,estado) VALUES ('27184','XXXXXXXXXX','','1'); INSERT INTO alunos (processo,nome,email,estado) VALUES ('16093','XXXXXXXXXX','','1'); The relational table "aluno_turmas" are not updated. Any help? Quote Link to comment https://forums.phpfreaks.com/topic/302252-trigger-issue/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.