2 Replies Latest reply on Sep 13, 2010 8:11 PM by Jun yuan

    Modifying the service file

    Jun yuan Level 1

      In the picture below, I enter the text field to search

      for o_name= MR TAN, however, when I entered the name, it came out with only one entry of MR TAN as shown below:

       

       

      Capture9.JPG

       

      Capture8.JPG

        • 1. Re: Modifying the service file
          Jun yuan Level 1

          The service file(used flex to generate template from PHP mySQL database then modified a bit):

           

          public function getTempByOwner($itemOname) {
           
            $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename where o_name=?");
            $this->throwExceptionOnError();
           
            mysqli_stmt_bind_param($stmt, 's', $itemOname); 
            $this->throwExceptionOnError();
           
            mysqli_stmt_execute($stmt);
            $this->throwExceptionOnError();
            $rows = array();
            mysqli_stmt_bind_result($stmt, $row->Change_id, $row->Part_Changed, $row->Owner_id, $row->Datechanged, $row->Requester_id, $row->C_made, $row->device_id, $row->Network, $row->Status, $row->o_id, $row->o_name, $row->o_contactNo, $row->o_email, $row->department, $row->d_id, $row->s_n, $row->type, $row->location, $row->r_id, $row->r_name, $row->r_contactno, $row->company, $row->r_email);
           
           

               while(mysqli_stmt_fetch($stmt)) {
               
                 $rows[] = $row;
                 $row = new stdClass();
                mysqli_stmt_bind_result($stmt, $row->Change_id, $row->Part_Changed, $row->Owner_id, $row->Datechanged, $row->Requester_id, $row->C_made, $row->device_id, $row->Network, $row->Status, $row->o_id, $row->o_name, $row->o_contactNo, $row->o_email, $row->department, $row->d_id, $row->s_n, $row->type, $row->location, $row->r_id, $row->r_name, $row->r_contactno, $row->company, $row->r_email);
              
            if(mysqli_stmt_fetch($stmt)) {
                 $row->Datechanged = new Datetime($row->Datechanged);
                 return $row;
            } else {
                 return null;
            }
          }}

          • 2. Re: Modifying the service file
            Jun yuan Level 1

            The problem is solved.

             

            I did not configure the input type and return type properly.

             

            Configure input type as string and output type as array[](by naming the array)

             

            Also, it is possible to use a drop down list, instead of  id. text(for text field),

            use id.selecteditem. (field)

             

            As for the service function, i copied the getAll, function will do.