0 Replies Latest reply on Sep 29, 2010 2:25 PM by scotchfasterr

    Cannot add a row to a database using generated PHP - possible bug?

    scotchfasterr

      Sorry if this is the wrong forum, but it seems to straddle a few different technologies.

       

      First, I followed this tutorial to generate PHP scripts for access to the databases:

      http://directormx2.com/devnet/flex/articles/flashbuilder4_introspector_php.html

       

      Next, I tried to add a button to add a row to the table. Here's my event handler, which seems to have no effect - even after restarting my program.

       

      protected function buttonAdd_clickHandler(event:MouseEvent):void
      {
      var user:User = new User();
      user.ID = 1000;
      user.FIRST_NAME = "Test";
      user.LAST_NAME = "User";
      user.DISPLAY_NAME = "hey you";
      user.COMPANY_ID = "2";
      user.LOGIN_ID = "100";
      user.LOGIN_PASSWORD = "xxx";
      user.DEPARTMENT = "dept";
      userService.createUser(user);
      }

      I discovered that if I right-clicked on Data/Services > UserService > createUser(item: User) : int, I could select "Test Operation..." and call the service function manually. I selected the "..." under Enter Value, entered the following data into the dialog, and verified that it was added to my database.

       

      {
      ID:200,
      FIRST_NAME:"test",
      LAST_NAME:"hey",
      DISPLAY_NAME:"hey",
      COMPANY_ID:2,
      LOGIN_ID:100,
      LOGIN_PASSWORD:"xx",
      DEPARTMENT:"xxx"
      }

       

      What's weird to me here is that COMPANY_ID and LOGIN_ID are strings, not integers, and yet if I use quotes on these fields the data is rejected (the OK button is not available). I can't assign ints to user.COMPANY_ID or user.LOGIN_ID in my MXML code, since these are declared as strings. Maybe this has nothing to do with the problem, but it seems suspicious to me.

       

      Any help would be greatly appreciated! If it's not blindindly obvious from my post, I'm not a PHP programmer, but am trying to build the simplest of RIAs. Thank you.