<?php
require_once __DIR__ . "/menu/includes/db.php";

db()->prepare("
    UPDATE discounts SET active = 0 
    WHERE active = 1 AND end_date <= NOW()
")->execute();

db()->prepare("
    UPDATE discounts SET active = 1 
    WHERE active = 0 AND start_date <= NOW() AND end_date > NOW()
")->execute();
