2 Replies Latest reply on Apr 3, 2008 1:36 AM by ab1301

    Adding New Row To MySQL Database From Flex?

    Cpt._Awesome
      I am creating a user login system using Flex, and I am having trouble getting it to add a new row when someone tries to register. The username and password is sent to the database and a new row is created, but the row that was created is blank. Therefore, when the person tries to login, the username and password isn't recognized. I think the problem is somewhere in my Flex code and not the database or PHP. Here is the code that calls that database:

      <mx:HTTPService id="registerNewUser" result="checkRegistration(event)" showBusyCursor="true" method="POST"
      url=" http://www.rockwaveguitar.com/siteAdmin/register2.php" useProxy="false">
      <mx:request xmlns="">
      <username>
      {username.text}
      </username>
      <password>
      {password.text}
      </password>
      </mx:request>
      </mx:HTTPService>
        • 1. Re: Adding New Row To MySQL Database From Flex?
          ntsiii Level 3
          I advise against declaring your request in mxml and binding in the values. It is just too hard to debug.

          Cerate the request object in the AS function in which you will invoke send. That way you can examine your data to make sure it is what you expect.

          It will look something like this:
          var sUserName:String = username.text;
          var sPassword:String = password.text;
          trace("sUserName=" + sUserName+ ", sPassword=" + sPassword)
          var oRequest:Object = {username:sUserName,password:sPassword}'
          registerNewUser.send(oRequest)

          Tracy
          • 2. Re: Adding New Row To MySQL Database From Flex?
            ab1301
            I use http services that look like that all the time, and they work fine. Are you positive the problem is with your flex, and not your php? Try using Microsoft Network Monitor (free download) to look at the post data being sent by flex. If the variables are being sent properly your problem is in php or mysql. If not, the data in the post request may help you figure out what is happening.