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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.