0

I'm trying to connect to MySql database in flex4. I wrote a php class like this,

public function getNames() {
 $stmt = mysqli_prepare($this->connection,
      "SELECT
          names.firstname,
          names.middlename,
          names.lastname
       FROM names");     

  $this->throwExceptionOnError();

  mysqli_stmt_execute($stmt);
  $this->throwExceptionOnError();

  $rows = array();
  mysqli_stmt_bind_result($stmt, $row->firstname, $row->middlename,
                $row->lastname);

  while (mysqli_stmt_fetch($stmt)) {
      $rows[] = $row;
      $row = new stdClass();
      mysqli_stmt_bind_result($stmt, $row->firstname, $row->middlename,
                $row->lastname);
  }

  mysqli_stmt_free_result($stmt);
  mysqli_close($this->connection);

  return $rows;

}

I just dragged and droped a datagrid into flex design mode. Then using data-> connect to php option, i selected file name.php from webroot. Then flex4 is giving this error, I have no clue about it, since it generated various services.

What is the flex expecting now?

 protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
                {
                    getNamesResult.token = name.getNames();
                }

Description Resource Path Location Type 1061: Call to a possibly undefined method getNames through a reference with static type String. flexphp.mxml /flexphp/src line 12 Flex Problem

Abhilash Muthuraj
  • 2,008
  • 9
  • 34
  • 48

1 Answers1

0

You can't call a function directly in PHP without having some kind of layer that can communicate with Flex since PHP functions aren't publicly available. You should look into AMFPHP or ZendPHP which provides this communication layer (amf remoting).

J_A_X
  • 12,857
  • 1
  • 25
  • 31