public function query( $query, array $data = [ ] )
    {
        $statement = $this->database->prepare( $query );

        if ( FALSE === $statement )
        {
            throw new DatabaseException( 'Failed to create prepared statement.' );
        }

        $result = $statement->execute( $data );

        $this->query = $statement->queryString;

        if ( FALSE === $result )
        {
            return [ ];
        }

        return $statement->fetchAll();
    }
public function query( $query, array $data = [ ] )
    {
        $statement = $this->database->prepare( $query );

        if ( FALSE === $statement )
        {
            throw new DatabaseException( 'Failed to create prepared statement.' );
        }

        $result = $statement->execute( $data );

        $this->query = $statement->queryString;

        if ( FALSE === $result )
        {
            return [ ];
        }

        return $statement->fetchAll();
    }
public function query ( $ query , array $ data = [ ] ) { $ statement = $ this -> database -> prepare ( $ query ) ; if ( FALSE === $ statement ) { throw new DatabaseException ( 'Failed to create prepared statement.' ) ; } $ result = $ statement -> execute ( $ data ) ; $ this -> query = $ statement -> queryString ; if ( FALSE === $ result ) { return [ ] ; } return $ statement -> fetchAll ( ) ; }
Call this function when you're expecting a result
from queries like SELECT.

@param string $query the query string
@param array  $data

@return mixed list of results or FALSE

@throws DatabaseException
Call this function when you re expecting a result from queries like SELECT .