mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO
Olá eu estou iniciando um projeto e estou criando a classe de conexao, porém esta dando o seguite erro:** Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in C:\wamp\www\imobiliaria\app\Conexao.class.php on line *44***
PHP:
<?php
/**
* classe que trata de conexao com o BD e operações
*/
class Conexao {
private $host;
private $user;
private $senha;
private $bd;
private $link;
public $query;
public $lista;
//private $tabela;
/**
* funcao construtora que inicia o link caso esteja null
*/
function __construct() {
if ($this->link == NULL):
$this->getConexao();
endif;
}
/**
* faz a conexao caso não tenha valores no LINK
*/
public function getConexao(){
$this->host = 'localhost';
$this->user = 'root';
$this->senha = '';
$this->bd = 'imovel';
$this->link = mysql_connect($this->host, $this->user, $this->senha) or die('Erro de conexao');
mysql_select_db($this->bd, $this->link);
mysql_set_charset('UTF8', $this->link);
}
/**
*
* @param type $sql - passo a minha sql
*/
public function ExecSQL($sql){
$this->query = mysql_query($sql, $this->link) or die(mysql_error());
}
/**
*
* @return type - retorna a lista de registros
*/
public function ListarDados(){
$this->lista = mysql_fetch_assoc($this->query);
return $this->lista;
}
/**
*
* @return type - retorna a contagem dos registros s query
*/
public function TotalRegistros() {
return mysql_num_rows($this->query);
}
}Discussão (3)
Carregando comentários...