我可以直接在SQL查询中使用我自己的函数吗(使用mySQL和PDO)?例如:在MySQL中使用PHP函数PDO
$query = null;
$result = null;
$query = $this->database_0->prepare("SELECT `id`, `salt` FROM `general_users` WHERE `username` = :username AND `password` = CONCAT(generatePassword(:password, `salt`)) LIMIT 1");
$query->bindValue(':username', $this->input->getValue('username'), PDO::PARAM_STR);
$query->bindValue(':password', $this->input->getValue('password'), PDO::PARAM_STR);
$query->execute();
$result = $query->fetch(PDO::FETCH_ASSOC);
$query->closeCursor();
查看“WHERE”情况下的第3行。
如果这是不可能的,我必须用户是否存在使用两个查询只是检查,它看起来不很理想。
感谢您的帮助,鲍尔泰克。
谢谢,这正是我需要的! – guest459473