I need to update only on records that are expired and adding a tolerance of x days
Example
Tolerance of 5 days
Today is = 11/10/2016
id = 1 expiration = 10/10/2016 // just update if today was day 15
id = 2 expiration = 06/10/2016 // perform update
id = 3 expiration = 10/10/2016 // just update if today was day 15
id = 4 expiration = 10/10/2016 // just update if today was day 15
Here is my code is not working right the rule
$query = mysql_query("UPDATE finan SET status='Vencido' WHERE status = 'Em Aberto' AND vencimento < CURDATE() + INTERVAL '$tolerencia' DAY ") or die(mysql_error());