2 Replies Latest reply on Mar 15, 2009 1:08 PM by Gregory Lafrance

    Can't connect to MySQL from Flex

    NoobFlexer
      Hi,

      I just started learning Flex a week ago and I'm still a noob in this area.
      I recently discovered about Cairngorm and tried to understand it.
      I managed to understand the Cairngorm diagram and applied that in my "Login" function.

      My problem is when I define a database connection to MySQL, I would get error in my Flex application, but when i define static variable the whole application would work just fine.

      The error is "NetConnection.call.failed: HTTP:failed"

      I'm using Zend Amf as the server.

      Please tell me what is the problem. Thanks!

      Regards,
      Joni

      ============ Edit ================
      I'm sorry,

      I just did some fix and this is the more specific details.

      If I use this code in my PHP

      mysql_connect(DBHOST, DBUSER, DBPASS);
      mysql_select_db(DBNAME);

      $query = "SELECT * FROM school";
      $result = mysql_query($query);

      return "test";

      Flex would be able to "get" the return value.


      But if I used this code

      mysql_connect(DBHOST, DBUSER, DBPASS);
      mysql_select_db(DBNAME);

      $query = "SELECT * FROM school";
      $result = mysql_query($query);

      return $result;

      Flex would get an error.


      Please help.

      Thanks.

      Regards
      Joni