Constantly failing at creating php code for a login form which will pull the ‘username’ from the database and correctly match that username with the password (which is saved in the database - phpmyadmin).
Using PDO, I have viewed some tutorials and phpnet manual.
I’m not looking for someone to give me a login script, but just to help me from scratch with some advice.
If you can’t spot the error on your own you really need to read up on basic PHP programming.
Furthermore, your code is just as susceptible to injection as it would be without prepared statements. Prepared statements don’t eliminate injection concerns if not used properly.
What information have you been reading because what you have derived is incorrect on various levels. Either the information your reading is incorrect or its being failed to be understood.
$sql = $db->prepare("SELECT * FROM tablename WHERE email ="$email" AND password="$pass");
You can modify this like;
$sql = $db->prepare("SELECT * FROM tablename WHERE email =[COLOR="Lime"]'[/COLOR]$email[COLOR="Lime"]'[/COLOR] AND password=[COLOR="Lime"]'[/COLOR]$pass[COLOR="Lime"]'"[/COLOR]);