11 Replies Latest reply on Apr 6, 2010 7:40 AM by Striker9099

    Returning an ArrayCollection from PHP

    Striker9099 Level 2

      hey everyone. I'm playing around with Flex RemoteObject class. I successfully inserted data into a db. Now I'm trying to retrieve the data and set the result as a dataProvider for a DataGrid or List component. I used Charles to check whether I'm receiving any data at all, and I found that everything is working properly except that I'm getting an Array and not an ArrayCollection. I tried casting the result inside Flex but that didn't work, the DataGrid still renders empty... any suggestions?


      Here's my PHP function:

      public function getUsers()


                $sql = "SELECT * FROM users";

                $res = mysql_query($sql);

                $params = array();

                while($row < mysql_fetch_array($res))


                     $user = new VOUser;

                     $user->id = $row['id'];

                     $user->name = $row['name'];

                     $user->surname = $row['surname'];

                     $user->email = $row['email'];

                     $user->password = $row['password'];

                     $user->company = $row['company'];

                     $user->phone = $row['phone'];

                     $user->fax = $row['fax'];

                     $user->job_position = $row['job_position'];

                     $user->website = $row['website'];

                     $user->vat_number = $row['vat_number'];

                     $user->ip_address = $row['ip_address'];

                     $params[] = $user;



                return $params;