I always set the return result as Object in my handler then type it as the
specific class later in the function. I'm not sure if I do this out of habit
or necessity.
# private function handleResult( result:Object ): void {
# var collection:ArrayCollection = result as ArrayCollection;
# }
Also notice that I used ArrayCollection. If I remember correctly, record
sets get returned as an ArrayCollection. If I am mistaken, try the above
with a standard Array.
Hope this helps,
~Aaron
On Mon, Mar 24, 2008 at 3:07 PM, Daniel Tse <[EMAIL PROTECTED]> wrote:
> Hi All,
>
> I have setup AMFPHP and it returns back the recordset object from a MySQL
> query. I was wondering how I access that array/recordset from the flex side.
>
> e.g. I have the following:
>
> <?php
> //In the services directory of AMFPHP
> class SimplePerson {
> function getPeople() {
> $mysql = mysql_connect(localhost, "root", "root");
>
> mysql_select_db( "people-test" );
>
> $sSQL = "SELECT * FROM `tblPeople`";
>
> $results = mysql_query($sSQL);
>
> return $results;
> }
> }
>
> ?>
>
> In Flex..
> public function getPeople():void {
> myService.connect(REMOTESERVERURL);
>
> var responder:Responder = new Responder(getPeople_Result,
> onFault);
> myService.call("SimplePerson.getPeople", responder);
>
> }
>
> public function
> getPeople_Result(aoResults:WHAT_SHOULD_GO_HERE):void
> {
> //test;
> //I'd like to access the result set e.g. iterate through
> the rows looking at certain columns
> }
>
> "Array" doesn't seem to work (the fact that it's a 1-dimensional array
> doesn't help)
> "XMLList" the object doesn't seem to map like that either
>
> Am I missing some kind of object?
>
> Thanks,
> -Daniel
> --
> -------------
> e: [EMAIL PROTECTED]
> w: http://DanielTse.com/
> -------------
>
>
--
Aaron Miller
Chief Technology Officer
Open Base Interactive, LLC.
[EMAIL PROTECTED]
http://www.openbaseinteractive.com