0

I have a function in my php class which must receive an array of Objects. In flex, I send the data (as ArrayCollection) calling the service. If I work locally, the PHP receive the data and store all the records in the database, but i I place such service in the server, the function doesnt work.

public function putPrecioBaseProductos($data) {

    $priveID = $data[0]->priveID;
    $date     = $data[0]->date;

    $res = mysql_query("DELETE FROM db.prices WHERE priveID=".$priveID." AND date='".$date."'");

    if (!$res) return '0';

    $cadena = "";
    for ($i=0; $i < count($data); $i++) {
        if ($cadena != '') $cadena .= ', ';
        $cadena .= "(".$priveID.", ".$data[$i]->productID.", '".$data[$i]->precio1."', '".$data[$i]->precio2."', '".$data[$i]->precio3."', '".$data[$i]->precio4."', '".$data[$i]->precio5."', '".$date."')";
    }
    $res = mysql_query( "INSERT INTO tabo4.precios_base (proveedorID, productoID, precio1, precio2, precio3, precio4, precio5, fecha) VALUES ".$cadena );

    if ($res) return '1'; else return '0';
}

I have been googling and found that amfphp do not support ArrayColletion as parameter but as i have just said, locally (using MAMP), data is received as desired but in server not.

Anyone know why?

Thanks.

Apalabrados
  • 1,098
  • 8
  • 21
  • 38
  • How can you be sure that it's the ArrayCollection that is causing this problem? Have you checked out the server log on your server that you're having problems? What is the error? – Marco Aurélio Deleu Feb 18 '13 at 02:43

1 Answers1

0

Try sending data as Array instead of ArrayCollection. ArrayCollection does not work well with AMFPhp ...

To get the array just use:

myArrayCollection.source;

Adrian Pirvulescu
  • 4,308
  • 3
  • 30
  • 47
  • can you please post some of your source code? are any methods in the same service working (with string or int params) ? – Adrian Pirvulescu Feb 18 '13 at 07:20
  • Hi Adrian, all methods within the service are working. Only the one that use ArrayCollection do not. As I mentioned before, using a MAMP installation in my computer all works fine, and when uploaded to a server, the method in the service using ArrayCollection do not. – Apalabrados Feb 18 '13 at 19:51