Link to home
Start Free TrialLog in
Avatar of MartiniMon
MartiniMon

asked on

Flash Remoting question with AMFPHP

Hi - thanks for reading;

so its my first attempt to return a recordset from php into a datagrid in flash via remoting. I have a datagrid named dgrid on frame one scene one with debig and remoting classes in the library.

Following includes my PHP , AS and the debugger info:

################################

<?php
//PHP ADODB document - made with PHAkt 3.6.0
//Connection statement
require_once('../../Connections/connTTSG.php');

// begin Recordset
$query_rsTest = "SELECT * FROM profiles ORDER BY last_name ASC";
$rsTest = $connTTSG->SelectLimit($query_rsTest) or die($connTTSG->ErrorMsg());
$totalRows_rsTest = $rsTest->RecordCount();
// end Recordset

class  test_tsg {
            // Method Table:
            function test_tsg()
                  {
                  
                  $this->methodTable = array(
                  
                              "getQuery" => array(
                              "description" => "back a resource",
                              "access" => "remote",
                              "returns" => "recordset"
                              )
                  );
                  }
                              
                  
                  // METHOD:
                  
                  function getQuery($col,$tab){
                  return($rsTest);
                  }
}
$rsTest->Close();
?>

################################

import mx.remoting.*;
import mx.rpc.*;
import mx.remoting.debug.*;
import mx.utils.Delegate;
import mx.controls.gridclasses.DataGridColumn;
import mx.controls.Alert;


var gatewayUrl:String = "http://mydomain.com/flashservices/debuggateway.php"
 
NetDebug.initialize();
var _service:Service = new Service(gatewayUrl, null, 'test_tsg', null , null);
var pc:PendingCall = _service.getQuery(1, 20);
pc.responder = new RelayResponder(this, 'handleDoRead', null);
 

//Get data back from server, show the post
      function handleDoRead(re:ResultEvent)
      {
            root.dgrid.dataProvider = RecordSet(re.result);
            }

 function handleError(fe:FaultEvent)
{
      trace('There has been an error');
}


################################

DebugId: "0"
EventType: "Status"
MovieUrl: "file:///C|/flash/main/remoting_test_0.00.swf"
Protocol: "http"
Source: "Client"
Time: 1147485046843
Date (object #1)
....."Fri May 12 21:50:46 GMT-0400 2006"
Status (object #2)
.....code: "AMFPHP_RUNTIME_ERROR"
.....description: "The returned      data was not of      the      expected type resource"
.....details: "/var/www/html/flashservices/amf-core/io/AMFSerializer.php"
.....level: "User Error"
.....line: 548


################################

In the end I am not going to use the datagrid, but will be setting propertied of mc's to values returned from the db so any tips regarding this will be appreciated if you respond. I am retrofitting an existing application that is using the traditional send and load and loadVars methodology.


Sure seems like I am close but just am missing that last bit here or there.

TIA and have a great wekend.
Avatar of Dushan Silva
Dushan Silva
Flag of Australia image

Sometimes following link might help for you.

http://www.kirupa.com/web/index.htm

BR Dushan
Avatar of MartiniMon
MartiniMon

ASKER

Thanks for responding , I have since solved this issue and am going to request the question be closed.
Notesd: The query object was not being returned as an aray, I rewrote the query statement and was able to get it to function properly.
ASKER CERTIFIED SOLUTION
Avatar of GranMod
GranMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial