Hello everybody,
I have a little problem. I want to fill a simple List
Component in Flex 2 beta 2 with name and firstname of students. But making
that, I face two different Problems :
############################### BEGIN CODE
#########################################
Here is the PHP code :
function getStudents () {
$mysql = mysql_connect(localhost, "root", "");
mysql_select_db( "bapp_db" );
//return a list of all the students
$query_students = "SELECT CONCAT('Nom',' ','Prenom') AS nomAndPrenom FROM
student_tbl ORDER BY Nom ASC";
$students = mysql_query($query_students) or
die(mysql_error."<br>".$query_students);
while ($row = mysql_fetch_object($students)) {
$ArrayOfUsers[] = $row['nomAndPrenom'];
}
return( $ArrayOfUsers );
}
And here is the Flex code :
<mx:Script>
<![CDATA[
[Bindable]
public var PHPData:Array;
import flash.net.Responder;
public var gateway : RemotingConnection;
public function init(): void
{
var gatewayUrl:String = "http://localhost/flashservices/gateway.php";
gateway = new RemotingConnection( gatewayUrl );
// gateway.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
gateway.call( "adminbapp.getStudents", new Responder(onResult,
onFault));
}
public function onResult( result : Array ) : void
{
PHPData = result;
}
public function onFault( fault : String ) : void
{
trace( fault );
}
]]>
</mx:Script>
And <mx:List id="students_list"
width="100%" height="100%"
dataProvider="{PHPData}"/>
################################# END CODE
#################################################### » » » »
Making like that I receive an error : Error
#2044: Unhandled NetStatusEvent: level=error, code=NetConnection.Call.BadVersion
But if I replace the line $ArrayOfUsers[] =
$row['nomAndPrenom']; by $ArrayOfUsers[] = $row; , my List is fill with lots of
[object Object].
Is someone have an idea of how I can fix my problem.
Maybe it is a basic problem, and it will help me to continue to work on my
Application if you help me.
Thank you a lot…
Regards,
William, Belgium.
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
YAHOO! GROUPS LINKS
- Visit your group "flexcoders" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

