remote object erreure dans le passage de parametre
Il y a la classe Data avec une méthode login
Sans parametre la methode login est bien prise en compte par flex.
Voici la methode Php login
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| function login$nom)
{
$rest = array();
// on se connecte
$link = mysql_connect("localhost", "root", "L099339R") or die ("Impossible de se connecter : " . mysql_error());
mysql_select_db("php",$link);
$sql = "SELECT * FROM amfphp_contact where nom='$nom' ";
// on envoie la requête
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
// on fait une boucle qui va faire un tour pour chaque enregistrement
while($data = mysql_fetch_assoc($req))
{
$id = $data['id'];
$nom = $data['nom'];
$prenom = $data['prenom'];
$email = $data['email'];
array_push($rest, array("id"=>$id, "nom"=>$nom, "prenom"=>$prenom, "email"=>$email));
}
// on retourne le tableau
return $rest;
} |
voici la partie flex 3 :
Code:
1 2 3
| <mx:RemoteObject id="donnees" fault="faultHandler(event)" showBusyCursor="true" source="workspace_amfphp.Data" destination="amfphp">
<mx:method name="login" result="resultHandler2(event)" fault="faultHandler(event)"/>
</mx:RemoteObject> |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
| <mx:Form x="167" y="10">
<mx:FormItem>
<mx:TextInput id="nom" />
</mx:FormItem>
<mx:FormItem>
<mx:TextInput x="295" y="48" id="email"/>
</mx:FormItem>
</mx:Form>
<mx:Label x="129" y="52" text="email" fontWeight="bold"/>
<mx:Button x="47" y="100" label="Trouver" click="donnees.getOperation('login').send(nom.toString());" />
<mx:DataGrid id="myDataGrid0" |