0 Replies Latest reply on Dec 14, 2012 3:27 PM by lucsenna1

    Flash Builder 4 and PHP  Data/Services for beginners

    lucsenna1

      Hello,

       

       

      I'm new here, so I do not know if I posted my doubts in the right place.

       

       

      without much la la la go straight to the point.

       

       

      I am developing an application in flex / mysql / php / zend DataWizard and used the flex to create the data service.

      populei my dropdown with the desired data (cities) and populei my datagrid with their respective data (customer master), so far so good. That's when I came across a difficulty which already makes two weeks and try to solve anything. the little knowledge I have in programming know it's something silly, but I can not solve.

       

       

      Difficulty: I select a city in my dropdown and display all my customers registered in the same city in my datagrid. simple! I found some tutorials on the net talking about it, did exactly what her boss but unfortunately got no success (not populates the datagrid), may be doing algor be unable to realize. so it follows my code so they can help me. grateful!!

       

       

      FLEX CODE

       

      / / Populating DropDownList City

      protected function ddl_cidade_cadastro_solutions_creationCompleteHandler(event:FlexEvent):void

      {

      getAllMunicipioResult.token = municipioService.getAllMunicipio();

      }


      //Populating DataGrid

      protected function ddl_cidade_cadastro_solutions_changeHandler(event:IndexChangeEvent):void

      {

      txt_recebe_cidade.text = ddl_cidade_cadastro_solutions.selectedItem.Cidade_PJ;

      getAllEmpresasResult.token = empresasService.getAllEmpresas(ddl_cidade_cadastro_solutions.selectedItem.Cidade_PJ);


      }





      PHP CODE

       

      public function getAllEmpresas($q) {

       

      $stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE 'Cod_Cidade_PJ' LIKE '%$q%'");

      $this->throwExceptionOnError();

       

      mysqli_stmt_execute($stmt);

      $this->throwExceptionOnError();

       

      $rows = array();

       

      mysqli_stmt_bind_result($stmt, $row->Codigo, $row->CGC, $row->CEmpresa, $row->NomeFantasia, $row->RazaoSocial, $row->Endereco_PJ, $row->Bairro_PJ, $row->CEP_PJ, $row->Cod_Cidade_PJ, $row->Cidade_PJ, $row->Estado_PJ, $row->TelefoneDDD_PJ, $row->Telefone_PJ, $row->FaxDDD_PJ, $row->Fax_PJ, $row->Email_PJ, $row->RecEmail_PJ, $row->HomePage_PJ, $row->NumFunc, $row->CodPorte, $row->Porte, $row->CodRegiao, $row->Regiao, $row->CodCNAE, $row->CNAE, $row->Produto, $row->ExportaPais, $row->IndustriaSN, $row->AnuncianteSN, $row->RowNumber, $row->negrito);

       

      while (mysqli_stmt_fetch($stmt)) {

      $rows[] = $row;

      $row = new stdClass();

      mysqli_stmt_bind_result($stmt, $row->Codigo, $row->CGC, $row->CEmpresa, $row->NomeFantasia, $row->RazaoSocial, $row->Endereco_PJ, $row->Bairro_PJ, $row->CEP_PJ, $row->Cod_Cidade_PJ, $row->Cidade_PJ, $row->Estado_PJ, $row->TelefoneDDD_PJ, $row->Telefone_PJ, $row->FaxDDD_PJ, $row->Fax_PJ, $row->Email_PJ, $row->RecEmail_PJ, $row->HomePage_PJ, $row->NumFunc, $row->CodPorte, $row->Porte, $row->CodRegiao, $row->Regiao, $row->CodCNAE, $row->CNAE, $row->Produto, $row->ExportaPais, $row->IndustriaSN, $row->AnuncianteSN, $row->RowNumber, $row->negrito);

      }

       

      mysqli_stmt_free_result($stmt);

      mysqli_close($this->connection);

       

      return $rows;

      }