hola maestros estoy intentando leer valores de php+mysql y ponerlos dentro de una datagrid.
fla.
import fl.data.DataProvider;
var myData:URLRequest = new URLRequest("http://localhost/flas_cs4/p2.php");
myData.method = URLRequestMethod.POST;
var loader:URLLoader = new URLLoader();
loader.dataFormat = URLLoaderDataFormat.VARIABLES;
loader.addEventListener(Event.COMPLETE, datagridOnLoad);
loader.load(myData);
function datagridOnLoad(evt:Event) {
var boards:Array = new Array();
for (var i:uint=0; i<evt.target.data.cant; i++) {
boards.push({label:evt.target.data["title"+i], data:evt.target.data["comments"+i]});
}
bldRosterGrid(aDg);
aDg.dataProvider = new DataProvider(boards);
aDg.rowCount = aDg.length;
}
function bldRosterGrid(dg:DataGrid){
dg.setSize(200, 200);
dg.columns = ["Title", "Comments"];
dg.columns[0].width = 100;
dg.columns[1].width = 100;
}
php.(p2.php)
<?php
error_reporting(0);
$connect = mysql_connect("localhost", "root", "");
mysql_select_db("aseo", $connect);
$result = mysql_query("SELECT a as t,a as c FROM a");
$cant=0;
while($row=mysql_fetch_array($result, MYSQL_NUM))
{
echo "title$cant=$row[t]&comments$cant=$row[c]&";
$cant=$cant+1;
}
echo "cant=$cant";
?>
y el php muestra esto:
title0=&comments0=&title1=&comments1=&cant=2
pero cuando lo ejecuto no me sale nada.
1046: Type was not found or was not a compile-time constant: DataGrid.
function bldRosterGrid(dg:DataGrid){
gracias por la orientacion