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.
– Sam
If it’s nothing to do, you have the "edit" link available to explain in your question what the problem is.
– Sam
The message
mysqli_result, null given
, means that the variable$resultado
spent inmysqli_fetch_assoc
this with the valueNULL
. 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– Guilherme Nascimento
Okay, I’m still beginner, could you tell me how I solve ? I don’t understand :/
– Luis de Souza
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.
– Guilherme Nascimento