I created a method which should return some parameters like this:
public function registerUser($email, $first_name, $last_name, $password, $salt)
{
$sql = "insert into user_Anmeldung set email=?, first_name=?, last_name=?, user_password=?, salt=?";
$statement = $this->conn->prepare($sql);
echo $email;
echo $first_name;
echo $last_name;
echo $password;
echo $salt;
if (!$statement) {
echo "FAIL";
return;
}
else
{
$statement->bind_param("sssss", $email, $first_name, $last_name, $password, $salt);
$returnValue = $statement->execute();
}
return $returnValue;
}
here i call the method :
$result = $dao->registerUser($userEmail, $userFirstName, $userLastName, $secured_password, $salt);
and here i use the result :
if($result)
{
$userDetails = $dao->getUserDetails($userEmail);
$returnValue["status"]="200";
$returnValue["message"]="Successfully registered new user";
$returnValue["userId"] = $userDetails["user_id"];
$returnValue["userFirstName"] = $userDetails["first_name"];
$returnValue["userLastName"] = $userDetails["last_name"];
$returnValue["userEmail"] = $userDetails["email"];
} else {
$returnValue["status"]="400";
$returnValue["message"]="Could not register user with provided information";
}
The variables $email
etc. arent empty but the $resultValue seems empty, because after calling a method which looks if the result is empty it returns true and i cant insert the information into my database...