Hi,
I also read your other post. I saw you were going into the wrong direction.
So, how to put data into a grid from mysql ?
- be sure to have the datagrid and remoting classes into your swf library.
- make a service (php file you put in the services directory of AMFPHP). Be
sure your file has the same name as
the class you're putting inside.
Then, simply make a sql request like this :
function fill_grid()
{
$sql4 = sprintf("SELECT blabla AS product, mlkdmf AS hihi,
etc..
FROM users AS u, etc..
WHERE ...join tables if you need...
AND ... the necessary conditions...");
$grid = mysql_query($sql4);
return $grid;
NetDebug::trace($grid);
}
In your flash file :
all the necessary imports for remoting and amfphp, netdebug if you wish. and
the services..
service = new Service(gatewayUrl, null, 'YOUR SERVICE NAME);
function fill_grid() {
var pc:PendingCall = service.fill_grid();
pc.responder = new RelayResponder(this, 'handleFill_grid',
'handleRemotingError');
trace(' test 444');
}
function handleFill_grid(re:ResultEvent) {
//callback code
YOUR GRID.dataProvider = re.result;
trace(' binnen handlefill 4');
}
This is it. Your grid wil be filled with the data from the SQL request. Change
your column names directly in the SQL request with the "AS" parameter, so
they'll appear like that in Flash. ex: "select users AS clients" will name
your column "clients" in the datagrid.
You can also transfer data in the other way. My project consists of a grid
filled with MySQL data, and three comboboxes
that can filter that data. I'm not filtering the data in the grid, but I made
a new SQL request and push the selected items in the comboboxes to the service,
and the service uses those values to perform the request.
For more info, check the amfphp site , or wikipedia (
http://wiki.media-box.net/ ) if you know french. You can also use a translator
like babelfish ;)
hope this helps you out ;)