Example #1
0
 /**
  * Open a new connection to the MySQL server
  * @param mixed $host
  * @param mixed $database
  * @param mixed $username
  * @param mixed $password
  * @param mixed $port
  * @return bool True if connected, False if failed
  */
 protected function __construct($host = DB_HOST, $database = DB_DATABASE, $username = DB_USERNAME, $password = DB_PASSWORD, $port = 3306)
 {
     $this->_error = new Database_Error();
     $this->_meta = new Database_Meta();
     $this->_link = parent::__construct($host, $username, $password, $database, $port);
     if (mysqli_connect_error()) {
         $this->_error->set_number(mysqli_connect_errno());
         $this->_error->set_message(mysqli_connect_error());
         return false;
     } else {
         self::$_link_instance = $this;
         self::$_link_parent = 'Database';
         return true;
     }
 }