Guest User

Untitled

a guest
Nov 24th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. $stmt = $pdo->prepare("SELECT curdate() FROM promocode");
  2. $stmt->execute();
  3. $row = $stmt->fetch();
  4. $currentdate = $row["curdate()"];
  5.  
  6.  
  7.  
  8. $stmt = $pdo->prepare("SELECT BeginDatum, EindDatum, Gebruikt, MaxGebruikt, PromocodeID FROM promocode");
  9. $stmt->execute();
  10.  
  11.  
  12. while ($row = $stmt->fetch()) {
  13. if ($currentdate >= $row["BeginDatum"] && $currentdate <= $row["EindDatum"] && $row["Gebruikt"] < $row["MaxGebruikt"]) {
  14. $actief = "yes";
  15. } else {
  16. $actief = "no";
  17. }
  18. $stmt = $pdo->prepare("UPDATE promocode SET Actief=? WHERE PromocodeID=?");
  19. $stmt->execute(array($actief, $row["PromocodeID"]));
  20. }
Add Comment
Please, Sign In to add comment