While studying, so do not judge strictly:

public function getUserNameByEmail($usE) { if ($result = $this->mysqli->prepare('SELECT `name` FROM `table` WHERE `email`=? LIMIT 1')); { $result->bind_param("s",$usE); $result->execute(); $result->bind_result($name); $result->fetch(); $result->close(); } return $name; } 

In principle, it works, there are no complaints, but now I need to write about such functions, reinsure myself. In general, I need to choose 1 value based on another. Just in the tutorial, in which I do, it does not say how it is done. I hope you will treat with understanding.

    1 answer 1

    If the question relates specifically to this function, then it is quite correct. You can still do buffering:

     $result->bind_param("s",$usE); $result->execute(); $result->bind_result($name); $result->store_result() // буферизация, если необходимо $result->fetch(); $result->close();