I have a simple error and can not find a solution, it seems to me that my problem is different from this answer here .
The error message is this: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, array given in **** on line 22
File connection .php
<?php
$con = mysqli_connect("localhost","root","","sis");
if (mysqli_connect_errno())
{
echo "Erro de conexão: " . mysqli_connect_error();
}
?>
Main file where the error occurs:
include_once('conexao.php');
$senha = '123456';
$sql = "SELECT * FROM arquivo WHERE senha = '$senha'";
$query = mysqli_query($con, $sql) or die(mysqli_error($con));
if(mysqli_affected_rows($con) == 1){
$resultado = mysqli_fetch_assoc($query);
$dados = mysqli_fetch_array($resultado);
echo $dados['idarquivo'];
}
In my database with name sis
in table arquivo
I have a row where column senha
has value 123456
.
Line 22 corresponds to $dados = mysqli_fetch_array($resultado);