5 Replies Latest reply on Oct 20, 2009 10:35 AM by David_F57

    Map MySQL to ArrayCollection in PHP

    Powder77

      Hi Guys

       

      I have had great success in passing data to flex using Zend AMF as an array of objects and using the result to populate Flex Charts.

       

      The problem is I want to use FusionCharts for Flex, this require me to pass an ArrayCollection to the FusionChart. The problem I am have having is building the the ArrayCollection in PHP.

       

      Eg

       

      $sql ="select label,value from table";

       

      $result = mysq_query($sql);

       

      while($row=mysql_fetch_object($result)

      {

       

      What code do I put here to build the arraycollection to pass back to flex

       

      }

       

      Here is what I am trying to mirror in flex

       

      private var chartData:ArrayCollection=new ArrayCollection([
                       { label:'Jan', value:'17400' },
                       { label:'Feb', value:'19800' },
                       { label:'Mar', value:'21800' },
                       { label:'Apr', value:'23000' },
                       { label:'May', value:'29000' },
                       { label:'Jun', value:'27600' }
                   ]);

       

      Thanks in advance

       

      Chris