0 Replies Latest reply on Feb 25, 2012 8:20 AM by Ankit Tanna

    Flash Builder Application, WAMP Server, PHP Service Problem

    Ankit Tanna Level 1

      Hye there,

      I am Ankit Tanna and I am a developer and a designer.
      I am currently facing problems with the database connectivities of the Flash Builder form with the WAMP server.

      I am using Flash Builder 4.5 along with the Zend AMF framework to connect the php services to the WAMP server database.

       

      The thing goes like this, I am unable to use generate the sample service from the WAMP database since my Flash Buider 4.5 is crashing again and again. Hence I decided to write my own php service file for the database connectivity.

       

      The details of the WAMP server database goes like this:

      - username: root

      - password: blank

      - hostname: localhost

      - port number: 80

      - database name: rmxuserdb

      - table name: users

       

      I have built a form with a few fields which is as shown in the figure:

       

      PHP my admin.JPG

       

      I am using this service code for connecting to the database:

       

      class UserService {

       

          var $username = "root";

          var $password = "root";

          var $server = "localhost";

          var $port = "3306";

          var $databasename = "employees";

          var $tablename = "employees";

       

          var $connection;

       

          /**

           * The constructor initializes the connection to database. Everytime a request is

           * received by Zend AMF, an instance of the service class is created and then the

           * requested method is invoked.

           */

      public function _construct() {

      $this->connection = mysqli_connect(

      $this->server, 

      $this->username, 

      $this->password,

      $this->databasename,

      $this->port

                                    );

       

      $this->throwExceptionOnError($this->connection);

          }

        

      public function createUser($item) {

          

      $stmt = mysqli_prepare($this->connection, "INSERT INTO $this->tablename (fname, lname, email, username, password, dob, address, city, state, zip, country, mobile, url) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");        

       

      $this->throwExceptionOnError();

              

      mysqli_bind_param($stmt, 'isssss', $item->fname, $item->lname, $item->email, $item->username, $item->password, $item->dob, $item->address, $item->city, $item->state, $item->zip, $item->country, $item->mobile, $item->url);

       

      $this->throwExceptionOnError();

       

      mysqli_stmt_execute($stmt);        

      $this->throwExceptionOnError);

              

      $autoid = mysqli_stmt_insert_id($stmt);

              

      mysqli_stmt_free_result($stmt);        

      mysqli_close($this->connection);

              

      return $autoid;

          }

       

      ?>

       

       

      Upon refreshing the service I get the following error:

       

      Error 1.JPG

       

      Error2.JPG

       

      I am not sure where to place this services file in which folder.

       

      Please guide me through this.

       

      Thank you.

      Ankit Tanna.