I'm trying to make the page display the documents sent by the user, but it always returns me the same error
Fatal error: Can not use object of type mysqli_result as array in> C: \ wamp64 \ www \ Project-EscolWeb \ student-query.php on line 158
The code on the line is this
<h1>Documentos:</h1>
<?php $arrayDadosDocumentos = ObtemDocumentos($rg);
$idTipo = $arrayDadosDocumentos[2];?>
I've already researched and always find the same solution, speaking to use '', but I do not know how to apply it in my code.
At that moment, thank you for your attention.
Q: If you need more information, please let me know.
Code of ObtemDocumento()
function ObtemDocumentos($rg){
include("conexao.php");
$SQL ="SELECT D.* FROM documento D JOIN alunodocumento AD WHERE AD.RG = ".$rg." AND D.IdCaixa = AD.IdCaixa AND D.IdLote = AD.IdLote AND D.idTipoDoc = AD.idTipoDoc ORDER BY D.idTipoDoc;" ;
$resultado = mysqli_query($conexao, $SQL);
if (!$resultado) {
$mensagem_erro = 'Erro de sintaxe na query: ' . mysqli_error() . "<br>";
$mensagem_erro .= 'SQL executado: ' . $SQL;
$destino = 'http://localhost/Projeto-escolweb/php/erro.php?msg='.$mensagem_erro;
header("Location: $destino");
exit;
}
return $resultado;