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('../../Connec tions/conn TTSG.php') ;
// begin Recordset
$query_rsTest = "SELECT * FROM profiles ORDER BY last_name ASC";
$rsTest = $connTTSG->SelectLimit($qu ery_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.Da taGridColu mn;
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:ResultEven t)
{
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/rem oting_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/flashservic es/amf-cor e/io/AMFSe rializer.p hp"
.....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.
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('../../Connec
// begin Recordset
$query_rsTest = "SELECT * FROM profiles ORDER BY last_name ASC";
$rsTest = $connTTSG->SelectLimit($qu
$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.Da
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:ResultEven
{
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/rem
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/flashservic
.....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.
ASKER
Thanks for responding , I have since solved this issue and am going to request the question be closed.
ASKER
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://www.kirupa.com/web/index.htm
BR Dushan