I am very new to PDO, and I was told that this morning he is heading in that direction. So listen to me. I am trying to rewrite my login verification function from standard mysql_query() into a prepared PDO report, but I am encountering some problems.
The loginCheck () function passes the provided letter and password, and then takes the salt from the corresponding letter, if the number of affected lines in this request is 1, apply the $salt variable to the result of this request.
For the last part of the function, I previously just used:
// standard mysql query goes here if (mysql_num_rows($query) == 1) { $salt = mysql_result($query, 0); }
Now my whole function looks like this:
// new mysql query below global $dbh; $stmt = $dbh->prepare("SELECT `salt` FROM `users` WHERE `email`=? LIMIT 1"); $stmt->execute($email); // not sure what to write here?
but it's hard for me to figure out how to translate the top of the code to something similar in PDO. I also probably do something else wrong here (as always), so point it to me as well.
I looked at the PHP manual and I just donβt understand most of it. Any ideas?
source share