-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconexao.php
More file actions
31 lines (25 loc) · 993 Bytes
/
conexao.php
File metadata and controls
31 lines (25 loc) · 993 Bytes
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
<?php
class Conexao{
public function __construct() {
//////// VARIAVEIS DE INSTANCIA - CREDENCIAIS
$this->servidor = null;
$this->dbname = null;
$this->usuario = null;
$this->senha = null;
$this->porta = null;
}
/////////// CONEXAO POSTGRES
public function conect_pg(){
$conn = pg_connect("host={$this->servidor} port={$this->porta} dbname={$this->dbname} user={$this->usuario} password={$this->senha}") or die ("N deu");
return $conn;
}
////////// CONEXAO SQL SERVER
public function conect_ssql(){
$conn = mssql_connect($this->servidor, $this->usuario, $this->senha);
if($conn == FALSE) die("Couldn't connect");
if(mssql_select_db($this->dbname, $conn))
$result = "Selected {$this->dbname} ok<br />";
else
die('Failed to select DB');
}
}