Jim R Posted September 6, 2017 Share Posted September 6, 2017 I've found numerous ideas on how to do this. Here is my current query: Action: After Event: Insert (a_players)* insert wp_termsset name = concat(NEW.nameFirst,' ',NEW.nameLast), slug = concat(NEW.nameFirst,'-',NEW.nameLast) * a_players is the table and not showing the in trigger window. I've tried to do it as a Before, but I already have a Before trigger, and for some reason I can't have two Befores. I'm getting this error: Can't update table 'a_players' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. However, it does insert the new row into wp_terms. The problem is I'm getting that error, prompting me cancel and it's inputting the row twice. Quote Link to comment https://forums.phpfreaks.com/topic/304888-triggers-inserting-row-into-a-second-table/ Share on other sites More sharing options...
requinix Posted September 6, 2017 Share Posted September 6, 2017 I feel like you haven't learned anything from the last couple threads. I'm pretty sure I linked you to some documentation. Did you read any of it? How much of what I've said regarding updating the table and modifying NEW did you understand? Quote Link to comment https://forums.phpfreaks.com/topic/304888-triggers-inserting-row-into-a-second-table/#findComment-1550847 Share on other sites More sharing options...
Jim R Posted September 6, 2017 Author Share Posted September 6, 2017 I felt like you missed me. If the issue is Before vs After, it's not letting me have multiple Before Triggers off the same table. What you linked the other day, I had already read. I'm trying NEW in various places, including NEW.name and NEW.slug, with and without use of other NEWs. Maybe I've missed a combination. Quote Link to comment https://forums.phpfreaks.com/topic/304888-triggers-inserting-row-into-a-second-table/#findComment-1550848 Share on other sites More sharing options...
Jim R Posted September 6, 2017 Author Share Posted September 6, 2017 This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table' Quote Link to comment https://forums.phpfreaks.com/topic/304888-triggers-inserting-row-into-a-second-table/#findComment-1550851 Share on other sites More sharing options...
Jim R Posted September 13, 2017 Author Share Posted September 13, 2017 Here is my current attempt, still not working: Trigger from a_players After Insert -- insert into wp_terms set name = concat(NEW.nameFirst,' ',NEW.nameLast), slug = concat(NEW.nameFirst,'-',NEW.nameLast) Quote Link to comment https://forums.phpfreaks.com/topic/304888-triggers-inserting-row-into-a-second-table/#findComment-1551245 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.