MySQL Forums
Forum List  »  Triggers

Trigger Creation Help?
Posted by: Steven Stanbridge
Date: November 06, 2016 02:34PM

Hello,
I am brand new to mysql databases and php but have been left with a task that I'm convinced is really simple but I'm struggling to get my head around the likely-obvious answer...

I am using phpMyAdmin and am trying to use the Trigger-->Add Trigger option.

I am trying to create a trigger whereby an 'after' 'insert' into table does the following (excuse incorrect syntax - that's the problem I'm having!)::
// what I've written in the "Definition" box //
UPDATE playerreg

SET playerreg.shortcode = transfers.transferno,
playerreg.club = transfers.transferto,
playerreg.updated_on = transfers.record_created,

FROM transfers, playerreg
WHERE transfers.playerregno = playerreg.playerregno
// END of what I've written in Definition //

It keeps telling me my syntax is incorrect near the "FROM transfers,....=playerreg.playerreg.no"... am I missing any commas or semicolons? Or am I just miles away from what I should be putting?

As the above suggests - the target is that whenever a transfer is entered (via a web-form), the trigger should become active whereby the player reg id in the player registration table should be checked for the corresponding player reg id in the transfers table, and once found it should amend the specified columns in the player registration table.

Hope this all makes sense! I'm not yet used to the syntax so not sure what's actually wrong with my attempt to create a trigger. FYI, my server version is listed as being 5.5.43 (percona server).

Options: ReplyQuote


Subject
Views
Written By
Posted
Trigger Creation Help?
2020
November 06, 2016 02:34PM
884
November 06, 2016 03:24PM
818
November 06, 2016 03:33PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.