I'm developing a project for college and I'm having some problems inserting into the my_sql database, my problem lies in that section.
mysqli_query($conn, "INSERT INTO funcionario(
codigo_funcionario,
nome,
cpf,
data_nascimento,
telefone,
estado,
motivo,
periodo,
cidade,
rua,
bairro,
numero,
complemento,
cep,
cnpj_empresa
) VALUES (
'".$this->getCodigoDoFuncionario()."',
'".$this->getNome()."',
'".$this->getCPF()."',
'".$this->getDataNascimento()."',
'".$this->getTelefone()."',
'".$this->getEstado()."',
'".$this->getMotivo()."',
'".$this->getPeriodo()."',
'".$this->endereco->getCidade()."',
'".$this->endereco->getRua()."',
'".$this->endereco->getBairro()."',
'".$this->endereco->getNumero()."',
'".$this->endereco->getComplemento()."',
'".$this->endereco->getCEP()."',
''
);");
My problem lies the moment I do
'".$this->endereco->getCidade()."'
I do not know if the problem is with my class, or if it is the syntax that is wrong.
I'm having these two errors "Undefined property" and "Fatal error: Call a member function getCity () on null". Could you give me a hand? Thanks!