Skip to main content
Inspiring
October 15, 2013
Question

retrieve Data thru Php failed?

  • October 15, 2013
  • 1 reply
  • 567 views

Hi, I want to retrieve a data from mysql database I have a field 'fname'  ( first name ), and I want an input box 'fnameS' in timeline to show it right from the beginning.

timeline script like this:

stop();

processCreate("retrieveData");

in my class document I have function like this:

public function processCreate(showCondition):void {

            trace ("get it");    //tested 'get it' shows in output

            var urlVars:URLVariables = new URLVariables();

            

            var urlFileRequest:URLRequest = new URLRequest("php/controlpanel.php");

            

            urlFileRequest.method = URLRequestMethod.POST;

                        

            urlFileRequest.data = urlVars;

           

            var php2Loader:URLLoader = new URLLoader();

            php2Loader.dataFormat = URLLoaderDataFormat.VARIABLES;

           

            if (showCondition=="retrieveData"){

                php2Loader.addEventListener(Event.COMPLETE, showResultS2); }

           

            urlVars.systemCall = showCondition;

            urlVars.email = email.text;

            urlVars.password = password.text;

            urlVars.fname = fname.text;

            urlVars.lname = lname.text;

           

            php2Loader.load(urlFileRequest); }

           

   

This topic has been closed for replies.

1 reply

Inspiring
October 15, 2013

public function showResultS2(event:Event):void {

     fnameS.autoSize = TextFieldAutoSize.LEFT;

     fnameS.text = "" + event.target.data.systemResult;

}

But then fnameS doesn't pick the data? Did I miss something?

Inspiring
October 15, 2013

And this is the php:

include_once "connect.php";

$email = $_POST['email'];

$password = $_POST['password'];

$fname = $_POST['fname'];

$lname = $_POST['lname'];

if ($_POST['systemCall'] == "retrieveData") {

            $selsql = "SELECT * FROM users WHERE email='$email'";

            $selquery = mysql_query($selsql);

           

            $login_counter2 = mysql_num_rows($selquery);

   

            if ($login_counter2 > 0) {

                while ($data = mysql_fetch_array($selquery)) {                   

                    $fname1 = $data["fname"];

                    print "systemResult=$fname1";

                }

            }

    }

Inspiring
October 15, 2013

I trace (fname.text); (from scene1) on scene 2  . shows nothing.

meaning values from scene1 isn't accessible on scene2? so what should I to get them?