0
votes

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.

1
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

1 Answers

0
votes

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

To get the array just use:

myArrayCollection.source;