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.00 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 = '". $email ."'");
  9.  
  10. $arg = array();
  11. $argmail = array();
  12.  
  13. while ($row = $stmt->fetch()) {
  14. array_push($arg, $row["email"], $row["dateSubs"], $row["dateUnsub"], $row["fk_id_options"]);
  15. array_push($argmail, $row["email"]);
  16. //print_r($arg);
  17. }
  18.  
  19. //print_r($arg);
  20.  
  21. if (empty($arg)) {
  22. echo "E-mail invalido";
  23. } else {
  24. $sql = "insert into unsubscribed (email, dateSubs, dateUnsub, fk_id_options) values (?, ?, ?, ?)";
  25. $pdo->prepare($sql)->execute($arg);
  26.  
  27. $sql = "delete from users2 where email = (?) ";
  28. $pdo->prepare($sql)->execute($argmail);
  29.  
  30. echo "Desinscrito.";
  31. }
  32.  
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement