Hi
I'm having problems with this function, it doesn't bind_result() any variables. So my "While" doesn't work either
public function getUserByEmailAndPassword($email, $password) {
$stmt = $this->conn->prepare("SELECT unique_id,name,email,created_at,updated_at, encrypted_password , salt FROM users WHERE email = ?");
$stmt->bind_param("s", $email);
if ($stmt->execute()) {
$stmt->store_result();
$num_of_rows = $stmt->num_rows;
$stmt->bind_result($aid, $aname, $aemail, $acreated_at, $aupdated_at , $aencrypted_password , $asalt);
echo $aemail; //no echo
while ($user=$stmt->fetch()) {
echo "inside while"; // no echo
$user[0] = $aid;
$user[1] = $aname;
$user[2] = $aemail;
$user[3] = $acreated_at;
$user[4] = $aupdated_at;
$user[5] = $aencrypted_password;
$user[6]= $asalt;
$user[7] = $password;
}
$stmt->free_result();
$stmt->close();
return $user;
} else {
echo "no $stmt->execute()"; //no echo
return NULL;
}
}
Any error in this code?
Thanks