A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: Flash->SQL->Flash

  1. #1
    Member
    Join Date
    Nov 2003
    Location
    Ontario, Canada
    Posts
    80

    Flash->SQL->Flash

    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.

  2. #2
    Junior Member
    Join Date
    Jul 2007
    Posts
    25
    You need a serverside script so yeah you need php or asp. You can't use Flash alone.

  3. #3
    Member
    Join Date
    Nov 2003
    Location
    Ontario, Canada
    Posts
    80
    Can someone give me a quick overview ast to how I might accomplish this. I dotn wantt to have to relaod the movie.

  4. #4
    Junior Member
    Join Date
    Jul 2007
    Posts
    25
    what do you mean by reloading the movie? why would you have to reload it?

  5. #5
    Member
    Join Date
    Nov 2003
    Location
    Ontario, Canada
    Posts
    80
    If I POST toa PHP script and query a database how do I get the returneed information back into the movie?

  6. #6
    Junior Member
    Join Date
    Jul 2007
    Posts
    25
    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.

  7. #7
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    use a LoadVars object, it has an onLoad function that will output the returned data
    Code:
    lv = new LoadVars();
    lv.dataToSend = "blah";
    
    lv.sendAndLoad("my.php", lv, "POST");
    
    lv.onLoad = function(){
    trace(lv.returnData); // php outputs - &returnData=Hello&
    }

  8. #8
    Member
    Join Date
    Nov 2003
    Location
    Ontario, Canada
    Posts
    80
    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?

  9. #9
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    without seeing your php and the stucture of your database,
    pretty much YES --
    you would probably send variables like -
    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.....}
    hth

  10. #10
    Member
    Join Date
    Nov 2003
    Location
    Ontario, Canada
    Posts
    80
    Awesome, this isnt goona be as hard as I thought.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center