Hello,
voilà je voulais tester un peu flex et je me suis basé sur ce tuto:
http://www.adobe.com/devnet/flex/articles/flex2_php.html
pour créer une interface qui en fonction du login/password d'une personne affiche une liste de movies.
Mais voilà, j'arrive pas à comprendre ce qui ne marche pas...j'obtiens tjs la même erreur...
http://movie.lvpathome.be/flex/test/movie.html
l'erreur:
[RPC Fault faultString="Error #1096: XML parser failure: Unterminated element." faultCode="Client.CouldNotDecode" faultDetail="null"]
at mx.rpc.http::HTTPService/http://www.adobe.com/2006/flex/mx/internal::processResult()
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()
at mx.rpc::Responder/result()
at mx.rpc::AsyncRequest/acknowledge()
at ::DirectHTTPMessageResponder/completeHandler()
at flash.events::EventDispatcher/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/flash.net:URLLoader::onComplete()
voilà mon code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" layout="absolute">
<mx:HTTPService id="userRequest" url="http://movie.lvpathome.be/flex/login.php" useProxy="false" method="GET">
<mx:request xmlns="">
<login>{loginText.text}</login><password>{passwordText.text}</password>
</mx:request>
</mx:HTTPService>
<mx:Form x="22" y="10" width="493">
<mx:HBox>
<mx:Label text="Login"/>
<mx:TextInput id="loginText"/>
</mx:HBox>
<mx:HBox>
<mx:Label text="Password"/>
<mx:TextInput id="passwordText"/>
</mx:HBox>
<mx:Button label="Submit" click="userRequest.send()"/>
</mx:Form>
<mx:DataGrid id="dgUserRequest" x="22" y="128" dataProvider="{userRequest.lastResult.movies.movie}">
<mx:columns>
<mx:DataGridColumn headerText="ID" dataField="movieId" width="100"/>
<mx:DataGridColumn headerText="Movie Name" dataField="movieName" width="400"/>
</mx:columns>
</mx:DataGrid>
</mx:Application>
et mon fichier php:
//connect to the database
$mysql = mysql_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD);
mysql_select_db( DATABASE_NAME );
// Quote variable to make safe
function quote_smart($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote if not integer
if (!is_numeric($value)) {
$value = "'" . mysql_real_escape_string($value) . "'";
}
return $value;
}
if( $_GET["login"] AND $_GET["password"])
{
$Query ='SELECT USER_Id, USER_Email '.
'FROM Users '.
'WHERE USER_Name="'.$_GET["login"].'" '.
'AND USER_Password="'.$_GET["password"].'"';
//echo $Query;
$Result = mysql_query( $Query );
if ($Result)
{
$Query = 'SELECT MOV_Date as movieDate, MOV_Name as movieName, MOV_Comment as movieComment, MOV_Id as movieId '.
'FROM Movies, Users '.
'WHERE MOV_UserId=USER_Id '.
'AND USER_Name="'.$_GET['login'].'" '.
'ORDER BY MOV_Date DESC';
//echo $Query;
$Result = mysql_query( $Query );
$Return = "<movies>";
while ( $Movie = mysql_fetch_object( $Result ) )
{
$Return .= "<movie><movieId>".$Movie->movieId."</movieId><movieName>".$Movie->movieName."</movieName></movie>";
}
$Return .= "</movies>";
//echo $Return;
mysql_free_result( $Result );
print ($Return);
}
}
Et ce qui est retourné par le fichier php:
http://movie.lvpathome.be/flex/login.php?l...mp;password=lvp
<movies>
<movie><movieId>18</movieId><movieName>truc</movieName></movie>
<movie><movieId>13</movieId><movieName>vbxvcbxc</movieName></movie>
<movie><movieId>12</movieId><movieName>sdfsdf</movieName></movie>
<movie><movieId>9</movieId><movieName>test</movieName></movie>
<movie><movieId>14</movieId><movieName>xcvxcvxcvx</movieName></movie>
<movie><movieId>16</movieId><movieName>zzzz</movieName></movie>
<movie><movieId>11</movieId><movieName>fsdfsd</movieName></movie>
<movie><movieId>8</movieId><movieName>test</movieName></movie>
<movie><movieId>6</movieId><movieName>sdfsdf</movieName></movie>
<movie><movieId>7</movieId><movieName>robocop</movieName></movie>
</movies>
merci d'avance pour le coups de main
