I’m trying to select data that won’t expire in the next 60 days so far I have this
$sql = "SELECT id FROM cooler WHERE expiry_date > CURDATE()";
which only shows data that has not expire.
Advertisement
Answer
Simply add 60 days to the CURDATE() with DATE_ADD and an INTERVAL of +60 DAY:
$sql = "SELECT id FROM cooler WHERE expiry_date > DATE_ADD(CURDATE(), INTERVAL +60 DAY)";