Advertisement
Guest User

aa

a guest
Nov 22nd, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. function deleteUser($pdo, $email) {
  2. $sql = "UPDATE users2 SET dateUnsub = now() WHERE email = (?)";
  3. $unsub = array();
  4. array_push($unsub, $email);
  5.  
  6. if ($pdo->prepare($sql)->execute($unsub)) {
  7.  
  8. $stmt = $pdo->query("SELECT email, dateSubs, dateUnsub, fk_id_options FROM users2 WHERE email = (?)");
  9. $pdo->prepare($stmt)->execute(array('email' -> $email));
  10.  
  11. $arg = array();
  12. $argmail = array();
  13.  
  14. while ($row = $stmt->fetch()) {
  15. array_push($arg, $row["email"], $row["dateSubs"], $row["dateUnsub"], $row["fk_id_options"]);
  16. array_push($argmail, $row["email"]);
  17. //print_r($arg);
  18. }
  19.  
  20. //print_r($arg);
  21.  
  22. if (empty($arg)) {
  23. echo "E-mail invalido";
  24. } else {
  25. $sql = "insert into unsubscribed (email, dateSubs, dateUnsub, fk_id_options) values (?, ?, ?, ?)";
  26. $pdo->prepare($sql)->execute($arg);
  27.  
  28. $sql = "delete from users2 where email = (?) ";
  29. $pdo->prepare($sql)->execute($argmail);
  30.  
  31. echo "Desinscrito.";
  32. }
  33.  
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement