Advertisement
Guest User

Untitled

a guest
Jul 28th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. public function getConnection() {
  2. try {
  3. // realiza a conexão
  4. $this->con = new PDO($this->dbType.":host=".$this->host.";dbname=".$this->db, $this->user, $this->senha,
  5. array( PDO::ATTR_PERSISTENT => $this->persistent ) );
  6. // realizado com sucesso, retorna conectado
  7.  
  8. return $this->con;
  9. } catch ( PDOException $ex ){ //caso ocorra um erro, retorna o erro
  10. echo "Erro: ".$ex->getMessage();
  11. }
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement