Can someone explain to me how to retrieve a RecordSet in an Actionscript 3.0 based file from AMFPHP.
The example below is taken from the homepage at http://www.amfphp.org/. It’s showing how to retrieve a MySQL query directly from AMFPHP without first having to convert it to a string.
As you can see flash is instanciating a RecordSet to catch the returned MySQL query. Is there an equivalent to doing this in Actionscript 3.0 as RecordSet seems to be an Actionscript 2.0 class only.
Sorry if this is a stupid question.
<?php
class pizzaService {
var $ordertable = "amfphp_orders"; // the orders table
var $pizzatable = "amfphp_pizzas"; // the pizzas table
/* mysql_connect and mysql_select_db are in the constructor */
function getOrderList ()
{
$sql = "SELECT o.order_id as orderid, o.order_status as status, o.order_name as name, p.pizza_id as pizzaid, p.pizza_details as details, p.pizza_quantity as quantity FROM $this->ordertable o, $this->pizzatable p WHERE o.order_id = p.order_id AND o.order_status=1 ORDER BY o.order_time";
return mysql_query($sql);
}
/* Other methods below */}
?>
import mx.remoting.*;
import mx.rpc.*;
var gatewayUrl:String = "http://amfphp.org/amfphp/gateway.php";
service = new Service(gatewayUrl, null, "pizzaService");
var pc:PendingCall = service.getOrderList();
pc.responder = new RelayResponder(this, "handleGetOrderList", null);
function handleGetOrderList(re:ResultEvent)
{
var rs:RecordSet = RecordSet(re.result);
for(var i = 0; i < rs.length; i++) {
var item = rs.getItemAt(i);
//item is an object with keys orderid, status, etc.
}
}