2 Replies Latest reply on Mar 28, 2010 4:00 AM by Matt Le Fevre

    pls help.. xml parsing and datagrid problem.. :(

    ulhas.sm

      i am building a small application using flex, php and mysqli...

       

      i am trying to connect a datagrid to a php.. the php parses a xml data to the flex... but when i execute the program the datagrid doesnt get populated.. can any one help me.. here r my code snippets..

       

       

      the database name is crm, table name is leads..

       

      column names are company, fname and lname respectively..

       

      <?php

          echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>";
         
          $conn = mysqli_connect('localhost', 'root', '', 'crm');
         
          $query = "SELECT * from leads";
         
          $result = mysqli_query($conn, $query);
             
          echo "<leadsxml>";
         
          while($row = mysqli_fetch_object($result))
          {
              echo "<leads><leadCompany>" . $row->company . "</leadCompany><leadFirstName>" . $row->fname . "</leadFirstName><leadLastName>" . $row->lname . "</leadLastName></leads>";
          }

          echo "</leadsxml>";
         
          mysqli_close($conn);
         
      ?>

       

       

      and the flex part

      <?xml version="1.0" encoding="utf-8"?>
      <mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" >

          <mx:HTTPService url = "getlead.php" id = "getleadHS" showBusyCursor="true" useProxy="false" method = "POST"/>
             
             
          <mx:DataGrid id = "leadDataGrid" width="400" height="240" dataProvider="{getleadHS.lastResult.leadsxml.leads}">
              <mx:columns>
                  <mx:DataGridColumn headerText="Company" dataField="leadCompany"/>
                  <mx:DataGridColumn headerText="First Name" dataField="leadFirstName"/>
                  <mx:DataGridColumn headerText="Last Name" dataField="leadLastName"/>
              </mx:columns>
          </mx:DataGrid>
         
      </mx:HBox>

      pls someone help me...