Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function deleteUser($pdo, $email) {
- $sql = "UPDATE users2 SET dateUnsub = now() WHERE email = (?)";
- $unsub = array();
- array_push($unsub, $email);
- if ($pdo->prepare($sql)->execute($unsub)) {
- $stmt = $pdo->query("SELECT email, dateSubs, dateUnsub, fk_id_options FROM users2 WHERE email = (?)");
- $pdo->prepare($stmt)->execute(array('email' -> $email));
- $arg = array();
- $argmail = array();
- while ($row = $stmt->fetch()) {
- array_push($arg, $row["email"], $row["dateSubs"], $row["dateUnsub"], $row["fk_id_options"]);
- array_push($argmail, $row["email"]);
- //print_r($arg);
- }
- //print_r($arg);
- if (empty($arg)) {
- echo "E-mail invalido";
- } else {
- $sql = "insert into unsubscribed (email, dateSubs, dateUnsub, fk_id_options) values (?, ?, ?, ?)";
- $pdo->prepare($sql)->execute($arg);
- $sql = "delete from users2 where email = (?) ";
- $pdo->prepare($sql)->execute($argmail);
- echo "Desinscrito.";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement