I would like to understand how I can do an insert function in php that uses an object as a parameter. Example:
class Aluno{
private $nome;
private $curso;
}
getters e setters...
public function insere(Aluno $aluno){
// suponho que aqui fica a definição dos atributos e o retorno do mysqli_query (não tenho certeza)
}
My question is how can I get this function to insert a record into the database when it is simply called by an instantiated object. And I would like this function to not undergo changes in the parameter, even if you put more attributes in the class. I need it to always be a Student object. I would also like to understand how I can use the return of this function.