I'm trying to create an trigger on phpmyadmin. My objective is to create a trigger that add the old value of a row with the new value (inserted with a form).
It's for managing the student dues, so if a student already paid $100, and pay $150 more the other time, the trigger have to add the old value ($100) with the new received value ($150), and the field 'already_paid' in the db is now $250.
I've tried something simple like this, but it didn't worked.
( BEFORE UPDATE )
SET @resultat = already_paid + new.already_paid
UPDATE student_dues
SET already_paid = @resultat
WHERE student_due_id = new.student_due_id
&
UPDATE student_dues
SET versement = versement + new.versement
WHERE student_due_id = new.student_due_id