PDA

View Full Version : Flex and PHP Integration problem


nstreetm
10-22-2009, 07:33 PM
Hey gang I'm new to Flex, trying to receive some data via PHP. Both the php and flex scripts run but it does not receive data. Just sits there waiting on response form the web server. Any help is appreciated here is my code.
PHP:
require('globals-mconnect.php');
if( $_POST["eagle"])
{
//add the user
$Query = "SELECT * FROM MYGSUSER WHERE USER_STUID= '".$_POST['eagle']."'";
$Result = mysql_query( $Query );
$Return = "<MYGSUSER>";
while ( $User = mysql_fetch_object( $Result ) )
{

$Return .= "<user><USER_PIDM>".$User->USER_PIDM."</USER_PIDM><USER_FNAME>".$User->USER_FNAME."</USER_FNAME><USER_LNAME>".$User->USER_LNAME."</USER_LNAME></user>";
}
$Return .= "</MYGSUSER>";
mysql_free_result( $Result );

}
?>

Flex Script:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" borderColor="#42DF64" backgroundGradientAlphas="[1.0, 1.0]" backgroundGradientColors="[#B1ACAC, #514E4E]">
<mx:HTTPService id="userRequest" url="https://webtest.georgiasouthern.edu:4102/portal/services/flextest2.php" useProxy="false" method="POST">
<mx:request xmlns="">
<eagle>{eagle.text}</eagle>
<USER_PIDM>{USER_PIDM.text}</USER_PIDM>
<USER_FNAME>{USER_FNAME.text}</USER_FNAME>
<USER_LNAME>{USER_LNAME.text}</USER_LNAME>
</mx:request>
</mx:HTTPService>
<mx:Form x="22" y="10" width="493">
<mx:HBox>
<mx:Label text="Eagle ID"/>
<mx:TextInput id="eagle"/>
</mx:HBox>
<mx:Button label="Submit" click="userRequest.send()"/>
</mx:Form>
<mx:DataGrid id="dgUserRequest" x="22" y="128" dataProvider="{userRequest.lastResult.MYGSUSER.user}">
<mx:columns>
<mx:DataGridColumn headerText="User Pidm" dataField="USER_PIDM"/>
<mx:DataGridColumn headerText="User First Name" dataField="USER_FNAME"/>
<mx:DataGridColumn headerText="User Last Name" dataField="USER_LNAME"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>

Thanks!

sparkdemon
11-01-2009, 12:30 AM
it wont work just like this. Instead of trying this way i suggest you use amfphp

ASWC
11-02-2009, 12:30 AM
print($Return);
got to print it on the page if you want Flex to read it.

mcerdeira
12-11-2009, 04:41 PM
In Flex try yo use:
<mx:HTTPService id="userRequest" url="https://webtest.georgiasouthern.edu:4102/portal/services/flextest2.php" useProxy="false" method="POST" resultFormat="e4x">
...

Att.