/** * @param string $params * * @return bool */ public function __construct($params) { parent::__construct($params); // mysqli connect if (empty($this->port)) { $this->connection = new mysqli($this->hostname, $this->username, $this->password, $this->dbname); } else { $this->connection = new mysqli($this->hostname, $this->username, $this->password, $this->dbname, $this->port); } if ($this->connection->connect_error) { Gcms::debug($this->connection->connect_error); } else { $this->connection->set_charset($this->char_set); } }
/** * @param string $params * * @return bool */ public function __construct($params) { parent::__construct($params); // mysql connect $conn = @mysql_connect($this->hostname, $this->username, $this->password, true); if ($conn != false) { $db = mysql_select_db($this->dbname, $conn); @mysql_query('SET NAMES ' . $this->char_set, $conn); } if ($conn == false) { Gcms::debug(mysql_error($conn)); return false; } else { $this->connection = $conn; return true; } }