What I’m trying to do:
Send a user input to PHP
Use this input to query a MySQL DB (This works fine)
Get the result back to Flash and put it in a dynamic Text Box - How???
The communication from Flash to PHP works fine. The variable I pass from Flash to PHP are used in the query as intended.
Then Im trying to send a variable back to flash. I cant display this variable in Flash, only in a new explorer window…
<?php
require ‘Include.php’; //Data about $DBhost,$DBuser,$DBpass
$user=$_GET[‘name’];
// Connects to the database.
mysql_connect($DBhost,$DBuser,$DBpass);
mysql_select_db("$DBName");
// The SQL query.
$query = “SELECT * FROM $table WHERE user =’$user’” ;
$result = mysql_query($query);
/* This just gets the number of rows in the Query */
$numR = mysql_num_rows($result);
// If the number of rows is 0–> no hits on query
if ($numR>0) {
for($i=0; $i < $numR; $i++) {
$row = mysql_fetch_array($result);
print $row[‘fname’]; //This prints ‘Bruno’ when user = ‘test’
}
}
else {
print "not connected ";
}
?>
Actionsript:
on (release) {
var my_vars = new LoadVars();
//Get the text from Input Text
my_vars.name=userName.text;
//Send input (my_vars) to PHP and assign result to my_vars
my_vars.send("http://localhost/lms/Login.php",my_vars,"POST");
//Set the result in Dynamic Text box with Var name status
status=my_vars.name;
}
I’ve read all the tutorials I was able to find, looked at the macromedia site, and still not able to solve it.
This problem has been driving me crazy for one week now. I scanned through this forum, but haven’t found anything useful for my case.
Hoping for replies, best regards
Jarle