0 Replies Latest reply on Sep 28, 2011 9:45 AM by Abhilash M

    Flex 4 with php error.

    Abhilash M

      Hi all, i'm connecting a flex application with database MySql, for that i'm using PHP as server side language. I followed a tutorial and created php class and tested. I'm getting the error at last step. This is what i did,


      1) create a php class name.php



      * This sample service contains functions that illustrate typical

      * service operations. This code is for prototyping only.

      *  Authenticate users before allowing them to call these methods.




      class name {

        var $username = "root";

        var $password = "";

        var $server = "localhost";

        var $port = "3306";

        var $databasename = "test";

        var $tablename = "names";


        var $connection;

        public function __construct() {

          $this->connection = mysqli_connect(











        public function getNames() {

           $stmt = mysqli_prepare($this->connection,





                 FROM names");    









            $rows = array();

            mysqli_stmt_bind_result($stmt, $row->firstname, $row->middlename,




            while (mysqli_stmt_fetch($stmt)) {

                $rows[] = $row;

                $row = new stdClass();

                mysqli_stmt_bind_result($stmt, $row->firstname, $row->middlename,









            return $rows;




         private function throwExceptionOnError($link = null) {

          if($link == null) {

            $link = $this->connection;


          if(mysqli_error($link)) {

            $msg = mysqli_errno($link) . ": " . mysqli_error($link);

            throw new Exception('MySQL Error - '. $msg);




      2)   Through data wizard, connect php and linked php class, it showed the methods and went to final step.


      3) Created a datagrid in flex, then dragged and droped getNames() to the datagid, then i configured return type. The datagrid then changed its fields to MySql table.


      4) Here was the problem, when i ran the application, it showed a error in this line,



                                    import mx.controls.Alert;

                                    import mx.events.FlexEvent;


                                    protected function dataGrid_creationCompleteHandler(event:FlexEvent):void


                                              getNamesResult.token = name.getNames();








      Error - 

      1061: Call to a possibly undefined method getNames through a reference with static type String.flexphp.mxml/flexphp/srcline 13Flex Problem

      I'm new to flex, so wondering where exactly is the problem?

      I did traced back few steps, like followed Control+click on getNames(), but it took me to actionscript file and everything seemed perfect. Since you guys have experience, hope you would throw some light on error. Thanks!