What I want to do is to add some credit (10% of user´s credit) to user´s account with each 3rd, 6th, 9th and 12th (not more) user added into database under this user´s invite link (but invite link isn´t essential here - each user has index column with ID of his invitator).
So something like this (sorry for "pseudocode", I never had to use the trigger and probably won´t have to any soon, so I have no idea how to write it properly):
UPDATE accounts.credit = accounts.credit + (accounts.credit/10) ON INSERT INTO users (AND when inserted row % 3 == 0 to some user) WHERE k_user = this Or is there any easier way how to do this? I could handle PHP, but I think the script can execute only if user visits the site...