I'm doing some object-oriented exercises in PHP and at the time of changing the database's data, I come across the following error
Catchable fatal error: Object of class mysqli_result could not be converted to string in /var/www/html/Aluno/class/AlunoDAO.php on line 30
I've never seen him before (in my long career for a few months). Can anyone tell me what it means?
Follow my code
Change-data.php
$id = $_POST['id'];
$nome = $_POST['nome'];
$cpf = $_POST['cpf'];
$senha = $_POST['senha'];
$alunoDAO = new AlunoDAO();
$nome_imagem = $alunoDAO->buscaFoto($conexao, $id);
$aluno = new Aluno($nome, $cpf, $senha, $nome_imagem);
$alunoDAO->alteraDados($conexao, $aluno, $id);
and my function in class AlunoDAO
(the one being pointed to an error).
function alteraDados($conexao, $aluno, $id){
$senhaMD5 = md5($aluno->getSenha());
$query = "update alunos set nome = '{$aluno->getNome()}', cpf = '{$aluno->getCpf()}', senha = '{$senhaMD5}', imagem = '{$aluno->getNomeImagem()}' where id = {$id}";
$resultado = mysqli_query($conexao, $query);
return $resultado;
}