I have the following code snippet:
public function registerUser($link, $nome, $sobrenome, $apelido) {
$sql = "INSERT INTO estudo_oo (id, nome, sobrenome, apelido) VALUES ('', '$nome', '$sobrenome', '$apelido') ";
if(!mysqli_query($link, $sql)) {
die('Error: ' . mysqli_error($link));
}
}
And my question is: Would I ALWAYS have to pass variables by parameter there in function? Why type, if I have a form with multiple fields for example, would I really have to pass all variables there?
I did some tests and tried to save the form without passing the variables by parameter, but I was not successful, hence I came to the question.