2
I have a simple mistake and I 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 connected.php
<?php
$con = mysqli_connect("localhost","root","","sis");
if (mysqli_connect_errno())
{
echo "Erro de conexão: " . mysqli_connect_error();
}
?>
Main file where error happens:
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 name database sis
on the table arquivo
i have a row in which column senha
has the value 123456
.
Line 22 corresponds to $dados = mysqli_fetch_array($resultado);
Has two
mysqli_fetch_*()
just one or the other, the second should not exist. It is receiving an array ($resultado
) when maybe you should receive a Resource ($query
). Then just change toecho $resultado['idarquivo'];
– rray
@rray thanks for the reply, if possible put your answer so that I put my question as answered.
– Wendell