【发布时间】:2018-12-27 13:18:55
【问题描述】:
执行时的mysqli准备语句只返回部分结果,即。在 fetch() $hash,$type 上保持它们的值但 $userId 保持为空,这个问题只出现在准备好的语句中。
if($statement=$this->db->prepare("SELECT `id`,`password`,`type` FROM `login` WHERE `username`=?")){
$statement->bind_param("s",$username);
if($statement->execute()){
$statement->bind_result($userId,$hash,$type);
if($statement->fetch()){
if(password_verify($password, $hash)){
$this->userId=$userId;
if($type=='u')
return true;
}else {
$this->error(11);
}
}else
$this->error(5);
}else
$this->error(4);
}else
$this->error(3);
【问题讨论】: