-1
Strangely a character began to appear in the <body> of a page I’m developing causing a blank line in the layout, stranger still, so I was able to identify is that if I remove the connection to my database the character disappears.
As can be seen in the image below:
The bank call is like this with a select:
include_once("_classes/conexao_pdo.class.php");
include_once("_classes/crud.dsc.class.php");
// Instancia Conexão PDO
$conexao = Conexao::getInstance();
$crud = Crud::getInstance($conexao);
// BUSCANDO DADOS DA EMPRESA
$rsEmpresa = "SELECT * FROM empresa WHERE empresa.status = 1";
$stm = $conexao->prepare($rsEmpresa);
$stm->execute();
$rsEmpresa = $stm->fetchAll(PDO::FETCH_OBJ);
// CONTAGEM DE REGISTROS RETORNADOS
$ContEmpresa = count($rsEmpresa);
// FECHANDO A CONSULTA
$stm->closeCursor();
foreach ($rsEmpresa as $DadosEmpresa) {
$historia = $DadosEmpresa->historia;
$missao = $DadosEmpresa->missao;
$visao = $DadosEmpresa->visao;
$valores = $DadosEmpresa->valores;
}
The connection is like this, connected_pdo.class.php
include_once('_connections/config_db.php');
class Conexao {
/*
* Atributo estático para instância do PDO
*/
private static $pdo;
/*
* Escondendo o construtor da classe
*/
private function __construct() {
}
/*
* Método estático para retornar uma conexão válida
* Verifica se já existe uma instância da conexão, caso não, configura uma nova conexão
*/
public static function getInstance() {
if (!isset(self::$pdo)) {
try {
$opcoes = array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8', PDO::ATTR_PERSISTENT => TRUE);
self::$pdo = new PDO("mysql:host=" . HOST . "; dbname=" . DBNAME . "; charset=" . CHARSET . ";", USER, PASSWORD, $opcoes);
} catch (PDOException $e) {
print "Erro: " . $e->getMessage();
}
}
return self::$pdo;
}
}
And config_db.php like this:
define('HOST', 'localhost');
define('USER', 'root');
define('PASSWORD', '');
define('DBNAME', 'banco');
define('TYPEDB', 'mysql');
define('CHARSET', 'utf8');
I honestly don’t know what it could be.
