Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Conn extends PDO {
- private $user='postgres';
- private $pass='202020';
- private $options=null;
- private static $instance;
- function __construct() {
- try {
- parent::__construct('pgsql:host=localhost;dbname=banco1', $this->user, $this->pass, $this->options);
- } catch (PDOException $ex) {
- print ($ex->getMessage());
- }
- }
- public static function getInstance() {
- if (!isset(self::$instance)) {
- self::$instance = new Conn();
- }
- return (self::$instance);
- }
- function __destruct() {
- self::$instance = null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement