Error mysqli_fetch_assoc () expects parameter 1 to be mysqli_result, boolean given in [duplicate]

-1

I am creating a code in html and php where I get the error "mysqli_fetch_assoc () expects parameter 1 to be mysqli_result, boolean given in", this code will show scores for a mini-golf tournament. the code gives me error in the code below.

<?php
        if($total){ do {
            $query1 = "SELECT nome from jogador WHERE nometeam = ".$linha['nometeam']; 
            $dados1 = mysqli_query($conn, $query1);
            $linha1 = mysqli_fetch_assoc($dados1);
print $query1
    ?>  
    
asked by anonymous 23.05.2018 / 12:27

1 answer

0

You have an error completing the code, so try.

<table class = "tabela" style="width:100%" border="0" bgcolor="white" style="text-align:center;">
<thead>
  <tr>
    <th>Equipa</th>
    <th>Jogador</th>
  </tr>
<tbody>
<?php
$query1 = "SELECT 'equipa','nome' from 'jogador' WHERE 'nometeam' = '".$linha['nometeam']."'";

$dados1 = mysqli_query($conn, $query1);

while($linha1 = mysqli_fetch_array($dados1)){
  echo "<tr>";
  echo "<td>" . $linha1['equipa'] . "</td>";
  echo "<td>" . $linha1['nome'] . "</td>";
  echo "</tr>";
}
?>
</tbody>
</table>
    
23.05.2018 / 12:36