Jump to content

Triggers: Inserting row into a second table...


Jim R

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.  

Link to comment
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?

Link to comment
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.  

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

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.