Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $stmt = $pdo->prepare("SELECT curdate() FROM promocode");
- $stmt->execute();
- $row = $stmt->fetch();
- $currentdate = $row["curdate()"];
- $stmt = $pdo->prepare("SELECT BeginDatum, EindDatum, Gebruikt, MaxGebruikt, PromocodeID FROM promocode");
- $stmt->execute();
- while ($row = $stmt->fetch()) {
- if ($currentdate >= $row["BeginDatum"] && $currentdate <= $row["EindDatum"] && $row["Gebruikt"] < $row["MaxGebruikt"]) {
- $actief = "yes";
- } else {
- $actief = "no";
- }
- $stmt = $pdo->prepare("UPDATE promocode SET Actief=? WHERE PromocodeID=?");
- $stmt->execute(array($actief, $row["PromocodeID"]));
- }
Add Comment
Please, Sign In to add comment