Problem mysqli_fetch_assoc() | is nothing to do with bolean ;)

Asked

Viewed 207 times

0

I am new here, I have a problem with the code below: someone can give me a light?

Code.:

<tbody> 
   <?php
   while($linha = mysqli_fetch_assoc ($resultado))
   {
      echo '<tr>';
      echo '<td>'. $linha['ID'] .'</td>';
      echo '<td>'. $linha['id'] .'</td>';
      echo '<td>'. $linha['id'] .'</td>';
      echo '<td>'. $linha['id'] .'</td>';
      echo '<td>'. $linha['id'] .'</td>';
      echo '<td>'. $linha['id'] .'</td>';
      echo '</tr>'; 
   }    
   mysqli_close ($conexao);     
   ?>
</tbody>

Error.:

Warning: mysqli_fetch_assoc() expects Parameter 1 to be mysqli_result, null Given in /home/u666149583/public_html/bootstrap/driver/listar.php on line 70

  • There’s a capital ID there.

  • If it’s nothing to do, you have the "edit" link available to explain in your question what the problem is.

  • The message mysqli_result, null given, means that the variable $resultado spent in mysqli_fetch_assoc this with the value NULL. In other words, it is the same problem that @ːvː cited yes, because mysqli_fetch_assoc expects a specific value, being null or Boolean is independent, the situation is that you did not check the value of $resultado and the linked answer explains how to do it. Another didactic answer would be this https://answall.com/a/28190/3635

  • Okay, I’m still beginner, could you tell me how I solve ? I don’t understand :/

  • The answer of rray is not didactic https://answall.com/a/28190/3635? I thought he explained so well, try to give a read again if possible.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.