What am I doing wrong in mysql database? I'm creating a trigger that deletes rows from a table when they are inserted. However, when the trigger executes I get the following message:


  MYSQL ERROR: Can't update table 'player_viplist' in stored
  function/trigger because it is already used by statement which invoked
  this stored function/trigge


What do I need to do for this trigger to work?

DROP TRIGGER dele;

DELIMITER |

CREATE DEFINER = 'root'@'localhost' TRIGGER dele
  AFTER INSERT
  ON player_viplist
  FOR EACH ROW
BEGIN DELETE FROM player_viplist ; 

END|

DELIMITER ;
If you are having a trigger on a table, You can not operate the same table which is used in the trigger.

As you mentioned you want to delete records from the table after inserting the records. Instead, why can't you skip inserting records to the table.

Can you mention your exact requirement in brief.