在phpmyadmin中自动擦除表数据

i'm developing a feedback form, where students will be allowed to give feedback on the particular subjects. I have a table with 3 fields "ID, Unique No, Password", where students admission number are stored. Now here is what i want. As soon as each students completes giving the feedback, his particular data's from the table must be deleted automatically. please help.

Like explained before use a trigger. Simply click on triggers and create a trigger that occurs after an INSERT in the table that records the feedback of the students. You could do something like this

enter image description here

I don't really agree though that using triggers is a good practice. Triggers are business logic and their logic should be implemented in your code. Separating business logic in your app and in your database makes it harder for the next developer to work on since he doesn't know where to look. The only reason that i think is viable to use them is when it is used for distributed databases to keep them updated in relation to each other.

This can be done with a JOIN, but I'll demonstrate a trigger here, because I mentioned it in my comment above.

I assume you've got another table where you store the students feedback data. Let's call it students_feedback and the other students_admission for this example.

Using MySQL Triggers, you assing the Database to delete the student admission data automatically ON INSERT. You'll want to use on create, because as soon as the feedback data is stored in the students_feedback table, the INSERT event is triggered.

So, for example:

CREATE TRIGGER delete_admission AFTER INSERT 
  ON students_feedback FOR EACH ROW 
  BEGIN 
    DELETE FROM students_admission WHERE students_admission.id=OLD.id LIMIT 1;
  END;

Use whatever DELETE query you want here.

NOTE: Before MySQL 5.0.10, triggers cannot contain direct references to tables by name.