I am looking for a way to delete old rows from my MySQL table and I have not really understood the questions and answears I have found so I was hoping that someone could clarify. I have added a Timestamp column to my table where I store the date the row was created. If the row is older than four months, I wan't to delete it. I have looked into triggers but if I have understood correctly, an insert trigger only alows you to work with the row that you insert? Maybe I'm wrong but I'm very new to triggers and don't even understand when/how to run them? Is it enough to just run them once, will the action automatically be repeated every time someone insert something (if it is an insert trigger)?
I run my insertQuery very often, everytime someone requests an URL to their painting. I am using php and my table is structured like this:
DatabaseID || theKey || Timestamp
1 abcd 2016-01-02
2 a1bc 2016-01-03
3 a1sb 2016-01-03
4 a12b 2016-01-05
EDIT: Forgot to mention, I would like the deletion of old rows to be automatic and run at least once a week.