0
I have a big problem.. I’m a beginner with Php, I’ve researched a lot but I can’t go on.
You’re making that mistake
Uncaught Error: Call to a Member Function mysqli_fetch_array() on Boolean in C: xampp htdocs teste.php**
Where is the error? Sorry if it’s something simple..
<?php
//Inicia página mudando a URL
echo "<html>";
echo "<head>";
echo " <title>Cliente</title>";
echo " <meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">";
echo "</head>";
echo "<body>";
//Conexão com o Banco
$servidor = '1.1';
$usuario = '**';
$senha = '**';
$banco = 'Organizacoes';
// Conecta-se ao banco de dados MySQL
$mysqli = new mysqli($servidor, $usuario, $senha, $banco);
// Caso algo tenha dado errado, exibe uma mensagem de erro
if (mysqli_connect_errno()) trigger_error(mysqli_connect_error());
// Conecta ao banco
$mysqli = new mysqli('1.1', '**', '**', '**');
// Executa uma consulta
$sql = "SELECT 'id', 'nome' FROM Organizacoes LIMIT 5";
$query = $mysqli->query($sql);
while ($dados = $query->mysqli_fetch_array()) {
echo 'ID: ' . $dados['id'] . '';
echo 'Nome: ' . $dados['nome'] . '';
}
echo 'Registros encontrados: ' . $query->num_rows;
?>
Your query failed, has syntax error, in table names or fields if they go quote, simply remove them.
– rray
Remove the quotes in the while part?
– Fernandinha
SELECT 'id', 'nome' FROM 'Instituicoes' LIMIT 5
, should just stay:SELECT id, nome FROM Instituicoes LIMIT 5
– rray