1
I used this code in php version 5, but after I switched to php 7, this error appeared.
Fatal error: Uncaught Error: Call to a Member Function fetch_array() array on
$selec = $mysqli->query("SELECT cpf_cnpj, isento, ... ");
$exec = $selec->fetch_assoc();
while($campos = $exec->fetch_array()) {
extract($campos);
$Array = Array();
$Array[] = Array(
"cpf_cnpj" => "$cpf_cnpj",
"isento" => "$isento",
);
$json_encode = json_encode($Array);
echo $json_encode;
}
What am I doing wrong?
Thank you.
very provavle some error in your query put this code after the query and see if Tis any error or $mysqli->query("SELECT cpf_cnpj, exempt, ... ") die(mysqli_error($db))
– Marcos Brinner
@Marcosbrinnerpikatoons appeared this error Parse error: syntax error, Unexpected 'die' (T_EXIT)
– Tiago
an ai "or" was missing before die $mysqli->query("SELECT cpf_cnpj, exempt, ... ") or die(mysqli_error($db))
– Marcos Brinner
@Marcosbrinnerpikatoons No error in Query, returned with the same error Fatal error: Uncaught Error: Call to a Member Function fetch_array() on array
– Tiago