1 Reply Latest reply on Dec 3, 2006 9:54 PM by Marghoob Suleman

    retrieving information from a DB

    Enfade
      the following script is behind a button and the script below it is a PHP file. I just cant figure out why i dont get any feedback back into flash in any form. Any help on where i went wrong is greatly apreciated.
      Thanks in advance,

      on (release) {
      code = new LoadVars();
      code2 = new LoadVars();
      code2.onLoad = function() {
      if (code2.entrycode == "1") {
      linkinfo == "something is wrong";
      } else {
      //linkinfo = code2.entrycode;
      gotoAndPlay(3);
      }
      };
      if (login == "" or pass == "" or login == "login name" or pass == "password") {
      linkinfo = "Input Error.";
      bckgrndlayer._visible = true;
      stop();
      } else {
      bckgrndlayer._visible = true;
      _root.linkinfo = "Retreiving Data";
      code.action = "insert";
      code.codex = login;
      code.codey = pass;
      code.sendAndLoad("retrievecode.php", code2, "GET");
      }
      }


      PHP:
      <?
      require("config.php");


      if ($_GET['action']=="insert") {
      $codex2 = $codex;
      $codey2 = $codey;
      $query = "SELECT logname, logpass FROM tbl_login WHERE logname = '$codex2' AND logpass = '$codey2'";
      $result = mysql_query($query);
      $numR = mysql_num_rows($result);
      }

      if ($numR == 0) {
      echo "&entrycode=1";
      } else {
      echo "&entrycode=2";
      }
      ?>
        • 1. Re: retrieving information from a DB
          Marghoob Suleman Level 1
          you could try to make a function rather than using on button.

          function connectToPHP() {
          code = new LoadVars();
          code2 = new LoadVars();
          code2.onLoad = function() {
          if (code2.entrycode == "1") {
          linkinfo == "something is wrong";
          } else {
          //linkinfo = code2.entrycode;
          gotoAndPlay(3);
          }
          };
          if (login == "" or pass == "" or login == "login name" or pass == "password") {
          linkinfo = "Input Error.";
          bckgrndlayer._visible = true;
          stop();
          } else {
          bckgrndlayer._visible = true;
          _root.linkinfo = "Retreiving Data";
          code.action = "insert";
          code.codex = login;
          code.codey = pass;
          code.sendAndLoad("retrievecode.php", code2, "GET");
          }
          }

          //write down on a button
          on(release) {
          connectToPHP()
          }


          should work.


          >>on (release) {
          >>code = new LoadVars();
          >>code2 = new LoadVars();
          >>code2.onLoad = function() {
          >>if (code2.entrycode == "1") {
          >>linkinfo == "something is wrong";
          >>} else {
          >>//linkinfo = code2.entrycode;
          >>gotoAndPlay(3);
          >>}
          >>};
          >>if (login == "" or pass == "" or login == "login name" or pass == "password") {
          >>linkinfo = "Input Error.";
          >>bckgrndlayer._visible = true;
          >>stop();
          >>} else {
          >>bckgrndlayer._visible = true;
          >>_root.linkinfo = "Retreiving Data";
          >>code.action = "insert";
          >>code.codex = login;
          >>code.codey = pass;
          >>code.sendAndLoad("retrievecode.php", code2, "GET");
          >>}
          >>}