php - number of bound variables doesn't match number of tokens -
this question has answer here:
here sample of problem occurs. browser says error @ stmt->execute()
;
function login($email, $password, $dbobj) { if ($stmt = $dbobj->prepare("select username, db_password, salt accounts email = :email limit 1")) { $stmt->bindparam(':username', $username); $stmt->bindparam(':db_password', $db_password); $stmt->bindparam(':salt', $salt); $stmt->bindparam(':email', $email); $stmt->execute(); // problem here $stmt->fetch(pdo::fetch_obj); $password = hash('sha512', $password . $salt); if ($stmt->rowcount() == 1) { // ... } } }
well, bind 4 variables :username
:db_password
:salt
, email
there 1 token in statement - :email
. not entirely sure trying either need amend sql or not use variables.
Comments
Post a Comment