开发者

flex4 with php, error referencing function

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 me开发者_开发问答thod getNames through a reference with static type String. flexphp.mxml /flexphp/src line 12 Flex Problem


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜