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.