Mysql
 sql >> Base de données >  >> RDS >> Mysql

PDO avec MySQL ne fonctionne pas dans l'activation par e-mail

function activate(PDO $db, $email, $email_code) {
    $sql  = "SELECT active, email_code FROM users WHERE email = ?";
    $stmt = $db->prepare($sql);
    $stmt->execute(array($email));
    $row  = $stmt->fetch();
    $if ($row && $row['active'] == $email_code && !$row['active'] )
        $sql  = "UPDATE users SET active = 1 WHERE email = ?");
        $stmt = $db->prepare($sql);
        $stmt->execute(array($email));
        return $stmt->rowCount();
    }
}