0
My code :
<?php
session_start();
$_SESSION['login'] = "";
?>
<?php
//arquivo com as configuracoes de HOST, USUARIO, SENHA e BANCO
require_once dirname(__FILE__).'/../../include/config.php';
// Conectar ao banco de dados das prefeituras
$db_selected_pref = mysqli_connect($HOST, $USUARIO, $SENHA,$BANCO);
//if (!$conectar_pref) { die('Não foi possível conectar: ' . mysqli_connect_error()); }
// Seleciona o banco de dados
//$db_selected_pref = mysqli_select_db($conectar_pref, $BANCO);
if (!$db_selected_pref) {die ('Não foi possível acessar a base: ' . mysqli_connect_error());}
//SELEIONA O CODIGO DA EMPRESA
if($_SESSION['login'] != "")
{
$NOME =$_SESSION['nome'];
$sql_codigo_empresa = mysqli_query($db_selected_pref,"SELECT codigo, ultimanota FROM cadastro WHERE nome = '$NOME'");
list($CODIGO_DA_EMPRESA,$ULTIMA_NOTA)=mysqli_fetch_array($sql_codigo_empresa);
}
// lista confguracoes
$sql_configuracoes = mysqli_query($db_selected_pref,"
SELECT
endereco,
cidade,
estado,
cnpj,
email,
secretaria,
lei,
decreto,
topo,
logo,
brasao,
codlayout,
declaracoes_atrazadas,
gerar_guia_site
FROM
configuracoes
");
list($CONF_ENDERECO, $CONF_CIDADE, $CONF_ESTADO, $CONF_CNPJ, $CONF_EMAIL, $CONF_SECRETARIA, $CONF_LEI, $CONF_DECRETO, $CONF_TOPO, $CONF_LOGO,$CONF_BRASAO, $CONF_CODLAYOUT,$DEC_ATRAZADAS,$GERAR_GUIA_SITE) = mysqli_fetch_array($sql_configuracoes);
$sql_boleto_banco = mysqli_query($db_selected_pref,"
SELECT bancos.boleto
FROM boleto
INNER JOIN bancos ON bancos.codigo = boleto.codbanco
");
list($BOLETO_BANCO)=mysqli_fetch_array($sql_boleto_banco);
?>
ERROR:
Warning: mysqli_fetch_array() expects Parameter 1 to be mysqli_result, Boolean Given in C: wamp64 www eiss site inc conect.php on line 74 Call Stack # Time Memory Function Location 1 0.0010 372272 {main}( ) ... conect.php:0 2 0.0030 411144 mysqli_fetch_array ( ) ... conect.php:74
Guys, I can’t fix this mistake, what I’m doing wrong???
your query ? of msqli this error says that what is being passed is not a result mysqli, but a Boolean 1 or 0
– user28266
puts at the end of your query mysqli_query an or die(mysqli_error()) then displays more details of the error
– user28266
Note: the original indicated uses MYSQL instead of MYSQLI, but the solution is the same. Put a
or die( mysqli_error( $CONEXAO ) )
in each row– Bacco
Guys, I tried to do as I was told, but the mistakes continue!!
– E.M C.
You can tell me which lines to enter the code in??
– E.M C.