Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function getConnection() {
- try {
- // realiza a conexão
- $this->con = new PDO($this->dbType.":host=".$this->host.";dbname=".$this->db, $this->user, $this->senha,
- array( PDO::ATTR_PERSISTENT => $this->persistent ) );
- // realizado com sucesso, retorna conectado
- return $this->con;
- } catch ( PDOException $ex ){ //caso ocorra um erro, retorna o erro
- echo "Erro: ".$ex->getMessage();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement