Jump to content
Jim R

Triggers: Inserting row into a second table...

Recommended Posts

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.  

Share this post


Link to post
Share on other sites

:facewall:

 

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?

Share this post


Link to post
Share on other sites

I felt like you missed me.   :happy-04:

 

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.  

Share this post


Link to post
Share on other sites

 

 

This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'

Share this post


Link to post
Share on other sites

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)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.