0 Replies Latest reply on Aug 3, 2006 3:31 AM by sobaka11

    Flex,AMFPHP and stored procedure in mysql

    sobaka11
      Hi!
      I ' ve read article Using Flex 2 and AMFPHP - article-
      Data from MySQL, with help of AMFPHP, is displayed in Flex application. This is AMFPHP service:

      <?php
      // Create new service for PHP Remoting as Class
      class sample
      {
      function sample ()
      {
      // Define the methodTable for this class in the constructor
      $this->methodTable = array(
      "getUsers" => array(
      "description" => "Return a list of users",
      "access" => "remote"
      )
      );
      }

      function getUsers () {
      $mysql = mysql_connect(localhost, "username", "password");

      mysql_select_db( "sample" );

      //return a list of all the users
      $Query = "SELECT * from users";
      $Result = mysql_query( $Query );
      while ($row = mysql_fetch_object($Result)) {
      $ArrayOfUsers[] = $row;
      }
      return( $ArrayOfUsers );
      }
      }
      ?>

      The query here is "SELECT * from users". I have the same stored procedure in MySQL( PROCEDURE showusers_proc()
      -SELECT * from users-). I want to call this procedure from the AMFPHP service instead of the query(SELECT * from users).
      When I change line ---> $Query = "SELECT * from users"; on line --> $Query = "CALL showusers_proc()"; Flex application doesn't display the data.
      What must I do, to make the application work correctly, using stored procedure?