Example #1
0
 public function __construct()
 {
     parent::__construct();
     $config = Config::getConfig("db");
     $this->mysqli = new \mysqli($config["server"], $config["username"], $config["password"], $config["name"], $config["port"]);
     if ($this->mysqli->connect_errno) {
         $this->throwDBExceptionOnError($this->mysqli->connect_error, $this->mysqli->connect_errno);
     }
 }
Example #2
0
 function __construct(\mysqli $mysqli_con = null)
 {
     parent::__construct();
     $config = Config::getConfig("db");
     if (!$mysqli_con) {
         @($this->mysqli_con = new \mysqli($config["server"], $config["username"], $config["password"], $config["name"], $config["port"]));
         if ($this->mysqli_con->connect_errno) {
             $this->throwDBExceptionOnError($this->mysqli_con->error, $this->mysqli_con->errno);
         }
     } else {
         $this->mysqli_con = $mysqli_con;
     }
 }