Integrating Pivot Table with PHP/MySQL

FlexMonster Pivot Table Component can be easily interated with your PHP site

We will guide you through simple PHP integration sample.

To integrate Pivot Table into your page you should accomplish the following steps:

  1. Copy content of Pivot folder (Pivot component and supported files) to root of your site or sandbox folder.
  2. Insert Pivot component into your .php file – paste code below:
    <script type="text/javascript" src="swfobject.js"></script>
    <div id="flashContent">No Flash player or Javascript disabeled message</div>
    <script type="text/javascript">
      var so = new SWFObject("PivotTable.swf", "flash", "1000", "720", "9", "#FFFFFF");
        so.addParam("allowScriptAccess", "sameDomain");
        so.addParam("menu", "false");
        so.addParam("allowFullScreen", "true");
        so.addVariable("filename", "your_data_script.php");
        so.addVariable("styleSheetName", "original.css");
        so.addVariable("configuratorEnabled", "true");
        so.addVariable("chartsEnabled", "true");
        so.write("flashContent");
        flash.focus();
    </script>
  3. Set path to your data file. To do this change value of filename FlashVar.
    so.addVariable("filename", "your_data_script.php");
  4. Now we are ready to write data source script.

Wrinting data source script

The best data format for Pivot Table Component is CSV. It most compact and can be easily convert to desired data structure. So now we will write simple CSV generator.

Your script should retreive data from database and output CSV file.

You can download full source code of this sample.