-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconecta.php
More file actions
38 lines (34 loc) · 1.12 KB
/
Copy pathconecta.php
File metadata and controls
38 lines (34 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
class conecta
{
protected $servidor;
protected $usuario;
protected $senha;
protected $banco;
public $conexao;
protected $query;
protected $dados;
function __construct()
{
$this->servidor = "localhost";
$this->usuario = "root";
$this->senha = "";
$this->banco = "grau";
self::conectar();
}
function conectar()
{
$this->conexao = @mysqli_connect($this->servidor, $this->usuario, $this->senha) or die("NÃO FOI POSSIVEL CONECTAR COM SERVIDOR DO BANCO DE DADOS <br>" . mysqli_error());
$this->banco = @mysqli_select_db($this->conexao, $this->banco) or die("NÃO FOI POSSIVEL CONECTAR AO BANCO DE DADOS <br>" . mysqli_error());
}
function ExecutarSQL($sql)
{
$this->query = @mysqli_query($this->conexao, $sql) or die("Erro ao execultar o comando SQL:$sql<br>" . mysqli_error());
return $this->query;
}
function Listar($query)
{
$this->dados = @mysqli_fetch_array($query);
return $this->dados;
}
} //fechamento da classe conexaoMysql.php