public function connect($host = null, $user = null, $password = null, $port = '3306', $database = null)
    {
        self::$_connection = array(
            'host' => $host,
            'user' => $user,
            'pass' => $password,
            'port' => $port,
            'database' => $database
        );

        try {
            self::$_connection['id'] = mysqli_connect(
                self::$_connection['host'],
                self::$_connection['user'],
                self::$_connection['pass'],
                self::$_connection['database'],
                self::$_connection['port']
            );

            if (!$this->isConnected()) {
                $this->__error('connect');
            }
        } catch (Exception $ex) {
            $this->__error('connect');
        }

        return true;
    }
public function connect($host = null, $user = null, $password = null, $port = '3306', $database = null)
    {
        self::$_connection = array(
            'host' => $host,
            'user' => $user,
            'pass' => $password,
            'port' => $port,
            'database' => $database
        );

        try {
            self::$_connection['id'] = mysqli_connect(
                self::$_connection['host'],
                self::$_connection['user'],
                self::$_connection['pass'],
                self::$_connection['database'],
                self::$_connection['port']
            );

            if (!$this->isConnected()) {
                $this->__error('connect');
            }
        } catch (Exception $ex) {
            $this->__error('connect');
        }

        return true;
    }
public function connect ( $ host = null , $ user = null , $ password = null , $ port = '3306' , $ database = null ) { self :: $ _connection = array ( 'host' => $ host , 'user' => $ user , 'pass' => $ password , 'port' => $ port , 'database' => $ database ) ; try { self :: $ _connection [ 'id' ] = mysqli_connect ( self :: $ _connection [ 'host' ] , self :: $ _connection [ 'user' ] , self :: $ _connection [ 'pass' ] , self :: $ _connection [ 'database' ] , self :: $ _connection [ 'port' ] ) ; if ( ! $ this -> isConnected ( ) ) { $ this -> __error ( 'connect' ) ; } } catch ( Exception $ ex ) { $ this -> __error ( 'connect' ) ; } return true ; }
Creates a connect to the database server given the credentials. If an
error occurs, a `DatabaseException` is thrown, otherwise true is returned

@param string $host
Defaults to null, which MySQL assumes as localhost.
@param string $user
Defaults to null
@param string $password
Defaults to null
@param string $port
Defaults to 3306.
@param null $database
@throws DatabaseException
@return boolean
Creates a connect to the database server given the credentials . If an error occurs a DatabaseException is thrown otherwise true is returned