1
I have the following php code that queries the database and returns a vector with the data.
public function executeSelect($query){
$resultado_id = mysqli_query($this->objetoConexao, $query);
if($resultado_id){
//Passa para um vetor o resultado da query
$dados_usuario = mysqli_fetch_array($resultado_id, MYSQLI_ASSOC);
return $dados_usuario;
}
else{
return null;
}
}
$query = "SELECT *
FROM prova_dados INNER JOIN prova_fotos ON (prova_fotos.id_dados_prova = prova_dados.id)
GROUP BY prova_fotos.id_dados_prova ";
$select = $dao->executeSelect($query);
echo var_dump($select['materia']);
But when I run this query in phpmyadmin in the "hand" it returns me two lines, with the data grouped as I want, but in the return of the mysqli_fetch_array it shows me only one line.
result of the same query in phpmyadmin
echo var_dump from php
Your query should even return only one line? if you don’t need a while and return an array.
– rray
It should return two lines, because in my bank has 2 prova_fotos.id_dados_prova diferentes
– Murilo Haas
would not echo var_dump($dados_usuario[]); ?
– Matheus Lopes Marques
Of a
var_dump($select);
and see the return structure of the result, you may have to put in a foreach to print the results– Darlei Fernando Zillmer
@Matheuslopesmarques If done with empty brackets of error
– Murilo Haas
what error of? tries without the brackets
– Matheus Lopes Marques
I managed to solve with the answer code from below, thank you.
– Murilo Haas