if(foo){
$value = email@mail.com;
}else{
$value = 123;
}
$req = $this->_aConnectionBdd->getConnection()->prepare("SELECT code_valid FROM users WHERE email = :email OR code_valid = :code_valid ");
$req->bindValue(':email', $value, \PDO::PARAM_STR);
$req->bindValue(':code_valid', $value, \PDO::PARAM_STR);
$req->execute();
$result = $req->fetch(\PDO::FETCH_ASSOC);
$req->closeCursor();
return $result['code_valid'];
how come than $result return NULL, How use OR with PDO mysql?
You select only code_validation field.
So the result should be return $result['code_validation'];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.