Trying to create a PHP function to delete rows from a DB after a variable number of days. Each row has a days_to_advertise
column and a date_created
column.
So far, I've tried just running below query :
`$check_and_remove = "DELETE FROM perch2_xreceiver_listings
WHERE date_created < UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL days_to_advertise DAY));";`
I'm not convinced that this will work - do I need to use a foreach
in some way?
Thanks