I have a little problem, that's the 4th tutorial about username checking but they're all in depreciated MySQL and I would like to do it with PDO
here is my code:
$stmt = $bdd->prepare("SELECT * from users WHERE username=?");
$stmt->execute(array($username));
if ( $stmt->rowCount() > 0 ) {
$message='Username already taken';
} else { $message='User added'; }
As I understood, the "rowCount" is the equivalent of mysql_num_rows so I don't think there's a problem with that, the problem must be with the SQL Query, it shows me "Username already taken" even if the username is not really taken.
Where am I wrong please ?
Thanks