0

I am using olap4php to connect to the Mondrian's default FoodMart XML schema and I need to run an MDX query on it to see whether I can get it to work.

My current code is as below :-

require_once( 'olap4php/autoload.php' );
use OLAP4PHP\Provider\XMLA\XMLAConnection;
$endpoint = "http://server:8888/myproject/FoodMart.xml";
$properties = array(
XMLAConnection::PROP_CATALOG => 'FoodMart',
XMLAConnection::PROP_DATASOURCE => 'Provider=Mondrian;DataSource=FoodMart'
);
$connection = new XMLAConnection( $endpoint, $properties );
if ($connection) {
    echo "yes";
}

The output is "yes" and so I believe the connection is working. Now I want to run an MDX query on it, some query like

SELECT {[Measures].[Unit Sales], [Measures].[Store Sales]} ON COLUMNS,
{[Product].members} ON ROWS
FROM [Sales]
WHERE [Time].[1997].[Q2] 
ilight
  • 1,622
  • 2
  • 22
  • 44

1 Answers1

0

The Getting Started Guide says to place your query string into $query and then:

use OLAP4PHP\Provider\XMLA\XMLAStatement;

$statement = new XMLAStatement( $connection );
$cellSet = $statement->executeOlapQuery( $query );