I am coding PHP and here is my code:
public function storeUser($name, $email, $password) {
$uuid = uniqid('', true);
$hash = $this->hashSSHA($password);
$encrypted_password = $hash["encrypted"]; // encrypted password
$salt = $hash["salt"]; // salt
$stmt = $this->conn->prepare("INSERT INTO users(unique_id, name, email, encrypted_password, salt, created_at) VALUES(?, ?, ?, ?, ?, NOW())");
$stmt->bind_param("sssss", $uuid, $name, $email, $encrypted_password, $salt);
$result = $stmt->execute();
$stmt->close();
// check for successful store
if ($result) {
$stmt = $this->conn->prepare("SELECT * FROM users WHERE email = ?");
$stmt->bind_param("s", $email);
$stmt->execute();
$user = $stmt->bind_result()->fetch_assoc();
$stmt->close();
return $user;
} else {
return false;
}
}
but I am getting this error and this warning and do not know how to solve it:
PHP Fatal error: Call to a member function fetch_assoc() on a non-object in file.php
Wrong parameter count for mysqli_stmt::bind_result() in file.php.