Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ?php
- class Connection {
- private static $instance;
- private $connection;
- private function __construct()
- {
- $cadena = "host='localhost' port='5432' dbname='newdb' user = 'postgres' password = 'system'";
- $this->connection = pg_connect($cadena) or die ('Error');
- $this->query("SET TIME ZONE -4");
- }
- public static function getInstance(){
- if (!isset(self::$instance))
- self::$instance = new Connection();
- return self::$instance;
- }
- public function query($aQuery){
- //echo "$aQuery<br>";
- return pg_query($this->connection, $aQuery);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement