Reputation: 11
How can I access the array data (i.e. id, nome, etc) of this:
stdClass Object
(
[_externalizedData] => Array
(
[0] => stdClass Object
(
[id] => 5
[tipo_usuario] => 0
[username] => [email protected]
[nome] => maria
)
)
[_explicitType] => flex.messaging.io.ArrayCollection
)
Upvotes: 0
Views: 143
Reputation: 28409
Looks like it would be, if $object
equals that
$object->_externalizedData[0]->id
as in
echo $object->_externalizedData[0]->id; // 5
echo $object->_externalizedData[0]->username; // [email protected]
OK more info given, that object = $Object_param
and OP wants to fix a loop
foreach ($Object_param->_externalizedData as $Obj)
{
// line breaks just for readability
$query="INSERT INTO grupo_usuario
(id_grupo,id_usuario)
VALUES
(1, '" . mysql_real_escape_string($Obj->id) . "')";
$result = mysql_query($query,$mysql);
error_log( print_r( $query, true ));
}
But you're going to set id_grupo to 1 for each row. Hopefully you know how to sort the SQL out now you see how to get one variable.
Upvotes: 1
Reputation: 71384
You would access it like this:
$outer_class->_externalizedData[0]->nome
Upvotes: 0