Advertisement
Guest User

Untitled

a guest
Jul 16th, 2016
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. ?php
  2.  
  3. class Connection {
  4. private static $instance;
  5. private $connection;
  6.  
  7. private function __construct()
  8. {
  9. $cadena = "host='localhost' port='5432' dbname='newdb' user = 'postgres' password = 'system'";
  10. $this->connection = pg_connect($cadena) or die ('Error');
  11. $this->query("SET TIME ZONE -4");
  12. }
  13.  
  14.  
  15.  
  16. public static function getInstance(){
  17.  
  18. if (!isset(self::$instance))
  19. self::$instance = new Connection();
  20.  
  21. return self::$instance;
  22. }
  23.  
  24. public function query($aQuery){
  25. //echo "$aQuery<br>";
  26. return pg_query($this->connection, $aQuery);
  27. }
  28.  
  29. }
  30.  
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement