Skip to content
Advertisement

MySQL trigger in phpMyAdmin [closed]

dont understand, why this not work :C

Help pls

Advertisement

Answer

To start with: the trigger name should not be surrounded with single quotes; you need backticks – or better yet, no quotes.

The deeper problem is that a trigger cannot action the table it fires upon. Your trigger code compiles, but when it runs it gives error:

Error: ER_CANT_UPDATE_USED_TABLE_IN_SF_OR_TRG: Can’t update table ‘authme’ in stored function/trigger because it is already used by statement which invoked this stored function/trigger.

I understand that you want to empty column idVK when the password changes. For this, you just need to set its value in pseudo-table NEW:

Demo on DB Fiddle – once the above trigger is created:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement