I have a PDO login system for online classes. Works fine! (normally)
The students register with an email and a password, and the login page asks for both.
This statement checks if the email is in the database:
1.
$stmt = $pdo->prepare('SELECT * FROM allstudents20EAP WHERE email = :email');
Today, I thought, "Actually, you only need to SELECT 1, so I changed this to:
2.
$stmt = $pdo->prepare('SELECT 1 FROM allstudents20EAP WHERE email = :email');
After that, the login failed every time, with the login error âIncorrect passwordâ
On a homework page, I also have this to check if the student number is in the database before the homework is uploaded:
3.
$stmt = $pdo->prepare('SELECT 1 FROM allstudents20BE WHERE studentnr = ?');
I have no column header 1 in any table, and this statement 3. works fine.
Any ideas why this statement 2. causes the login to fail??
I changed 1 back * to again and it works fine again.