0
I wanted to show the names of the employees and the teams that they are part of so that if the user enters a name, it will filter all the teams that that person is part of. It’s coming in white.
try{
$pdo = Conexao::getInstance();
$consulta = $pdo->prepare("SELECT id_equipe,nome_equipe,GROUP_CONCAT(nome_eletricista) as equipes FROM quadro WHERE id_agencia=:id AND status=1 GROUP BY nome_equipe ORDER BY nome_equipe ASC");
$consulta->bindParam(':id',$id_agencia, PDO::PARAM_INT);
if($consulta->execute()){
if($consulta->rowCount() > 0){
while($dados = $consulta->fetch(PDO::FETCH_OBJ)){
$id_equipe= $dados['id_equipe'];
$nome= $dados['nome_equipe'];
$equipe= $dados->nome_equipe;
$equipes=$dados->equipes;
echo'<option value="'.$id_equipe.'">'.$nome.' - '.$equipes.'</option>';
}
}
}
}catch(PDOexception $e){
echo "ERROR: " . $e->getMessage();
}
?>
</select>
<br>
When you perform the
query
in the terminal or Phpmyadmin, it brings some result?– Valdeir Psr
Oops! Gives an error: #1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'empresa_db.quadro.id_equipe' which is not functionally dependent on Columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
– Isadora Almeida