PHP Warning: mysqli_fetch_array() expects Parameter 1 to be mysqli_result, null Given in

Asked

Viewed 13 times

1

I’m having trouble making a query in the database. I’ve tried the same command in the database and it worked normally. Follow the code:

$resultado = mysqli_query("SELECT * FROM usuario ORDER BY nome;");          
$linha = mysqli_num_rows($resultado);

while($linha = mysqli_fetch_array($resultado)){
    echo "<tr>";
        echo "<td>".$linha['matricula']."</td>";
        echo "<td>".$linha['nome']."</td>";
        echo "<td>".$linha['nivel_acesso']."</td>";
    echo "</tr>";
}
  • 1

    Missed passing the connection to the mysqli_query() which is the first argument.

  • 1

    It worked, thank you!

No answers

Browser other questions tagged

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