Is there a way to send and recieve information from FLash to SQL without having to reload the flash movie? Does this hav to be doen using PHP/ASP/Java or can it be coded in Actionscript.
Printable View
Is there a way to send and recieve information from FLash to SQL without having to reload the flash movie? Does this hav to be doen using PHP/ASP/Java or can it be coded in Actionscript.
You need a serverside script so yeah you need php or asp. You can't use Flash alone.
Can someone give me a quick overview ast to how I might accomplish this. I dotn wantt to have to relaod the movie.
what do you mean by reloading the movie? why would you have to reload it?
If I POST toa PHP script and query a database how do I get the returneed information back into the movie?
you take the query results back via php, and display it via actionscript - all done on the one button... you don't need a "post" and then "display" button.
use a LoadVars object, it has an onLoad function that will output the returned dataCode:lv = new LoadVars();
lv.dataToSend = "blah";
lv.sendAndLoad("my.php", lv, "POST");
lv.onLoad = function(){
trace(lv.returnData); // php outputs - &returnData=Hello&
}
So in my Data sent to PHP I would be somthing like "bio, smith, j"
And the first variable "bio" is defined in teh PHP as to what type of search to do using the the given information, inthis case "smith, j". And the the lv.returnData is what ever SQL finds?
without seeing your php and the stucture of your database,
pretty much YES :D --
you would probably send variables like -hth :)Code:lv = new LoadVars();
lv.db = "my_clients";
lv.action = "search";
lv.myQuery = "bio";
lv.lastName = "Smith";
lv.firstName = "J";
in your php -
$database = $_POST[db];
$action = $_POST[action];
$myQuery = $_POST[myQuery];
$lastName = $_POST[lastName];
$firstName = $_POST[firstName];
if($action == "search"){
mysql_connect($dbhost,$dbuser);
@mysql_select_db($database) or die( "Unable to select database");
...your search code.....}
Awesome, this isnt goona be as hard as I thought.