glob =& $GLOBALS; } public function getConnection() { $this->connection = null; $this->db_host = $this->glob['CONF']['DB']['HOST']; $this->db_name = $this->glob['CONF']['DB']['DB_NAME']; $this->db_user = $this->glob['CONF']['DB']['USER']; $this->db_password = $this->glob['CONF']['DB']['PASSWORD']; try { $this->connection = new PDO("mysql:host=" . $this->db_host . ";dbname=" . $this->db_name, $this->db_user, $this->db_password); } catch(PDOException $exception) { echo "Connection failed: " . $exception->getMessage(); } return $this->connection; } } ?>