3 Replies Latest reply on Jul 13, 2010 9:13 AM by VRPDeveloper

    Database data to an ArrayCollection

    re-Flexing

      Hi there, Good day!

      I'm very new in Flex

       

      I'm having a problem on putting data on an ArrayCollection

       

      Here is my Code:

      ------------------------------------------------------------------------------------------ ------------

       

       

      [Bindable]

      public var contactArray:ArrayCollection = new ArrayCollection();

       

       

      public function collectArray(event:ResultEvent):void{

       

           contactArray = event.result.result.list;

       

           var tempNo:ArrayCollection = new ArrayCollection();

       

       

           for(var i:int = 0; i<=contactArray.length; i++){

           getArrayTxt.text = ""+contactArray[i];

                }

      }

       

      <mx:HTTPService id="contactHttp" url="http://localhost/frontlineSMS_Flash-debug/tryArray.php" method="POST" useProxy="false" result="collectArray(event)">

           <mx:request xmlns="">

              </mx:request>

      </mx:HTTPService>

       

      ------------------------------------------------------------------------------------------ ------------

      I'm getting an [object Object] result in my getArrayTxt.text.

      why is that happening?

       

      This is my PHP Code:

      ------------------------------------------------------------------------------------------ ------------

      $query = "SELECT contactNo from frontlinesms_msg";

       

      $result = mysql_query($query) or die ("Query failed: ".mysql_error() ."Actual query: ". $query);

       

      print "<result>";

      while ($recordset = mysql_fetch_object($result) ) {

      print "<list>

         <contactNo>".$recordset->contactNo."</contactNo>

      </list>";

      }

      print "</result>";

      ?>

      ------------------------------------------------------------------------------------------ ------------