2 Replies Latest reply on Oct 7, 2009 1:02 PM by 80sRelic

    Assign data from PHP to FB variable

    80sRelic Level 1

      This is no doubt very basic stuff but I am spinning my wheels.


      So far I can get MySQl Data from PHP just fine if I drop functions from my PHP classes onto components like DataGrids, Lables etc. But what I would also like to do is make a call to a PHP class and put the result into a variable. For instance I would like to store the row count of a query in an FB variable. So I have:


      public var myCount:int;




      How do I make a call to the PHP class and assign it to myCount?


      Any help is greatly appreciated.

        • 1. Re: Assign data from PHP to FB variable
          mewk Level 3



          there is no good autogenerated method to do this yet (see discussion here), but you can easily code this in yourself. suppose you have the operation getCount() on the service myPhpService, then you would have some code like this:


                      public var myCount:int;
                      protected function init():void {
                          getCountResult.token = myService.getCount();
                      protected function getCountResultHandler(): void {
                          myCount = getCountResult.lastResult;
                  <s:CallResponder id="getCountResult" result="getCountResultHandler()" />
                  <services:MyPhpService id="myService" />


          you can get most of this data by temporarily creating a button, generating a service call on the button and then changing as actionscript needed. hope that helps,


          - e

          1 person found this helpful
          • 2. Re: Assign data from PHP to FB variable
            80sRelic Level 1

            I replied in the thread that you mentioned by accident. Thanks very much, your post was very helpful.