public function __construct() { $this->userId = $_SESSION['user_id']; $this->viewModel = new ViewModel(); $this->commonViewData(); $this->dbAdapter = new DB_Adapter(DB_Controller::call(), $this->userId); }
public static function call() { if (self::$db_instance == null) { self::$db_instance = new mysqli(HOST, USERNAME, PWD, DBNAME); if (self::$db_instance->connect_errno) { echo "Failed to connect to MySQL: (" . self::$db_instance->connect_errno . ") " . self::$db_instance->db_instance->connect_error; } } return self::$db_instance; }