'; $this->$db = null; $this->connect(); print ''; } // public function __destructor() { // if ($this->$db) { // pg_close($this->$db); // } // } // Establish connection to the db private function connect() { print ''; // Get credentials print ''; require('command.php'); print ''; // Credentials String $creds = "host=localhost port=5432 user=" . $dbadminusername . " password=" . $dbadminpassword . " dbname=inventorytrackdb"; print ''; if (!$this->$db) { //$this->$db = new PDO('pgsql:host=localhost;port=5432;dbname=inventorytrackdb', $dbadminusername, $dbadminpassword); $this->$db = pg_connect($creds); } if (!$this->$db) { echo '
NOT ACTUALLY CONNECTED TO DB WTHHH
'; } print ''; } public function test_con() { print ''; $result = pg_query($this->$db, "SELECT * FROM users_table;"); // $result = $this->$db->prepare("SELECT * FROM users_table;"); // $result->execute(); // $recordset = $result->fetchAll(); // $result->closeCursor(); print ''; return pg_fetch_all($result); } } ?>