Jump to content

Adding to the next element in a multidimensional array


nimzie

Recommended Posts

Hi, I'm trying to add a value to $node->field_spaces[x]['nid'] where x is the next available spot in the field_spaces array. Always adding to the next spot. I'll be calling this in a for loop to add things in there... Can anyone offer a hand?

 

$node->field_spaces (array)

    $node->field_spaces[0] (array)

        $node->field_spaces[0]['nid']

 

Thank you,

adam

I think what it has to do as it loops through the values to add is something like

 

$node->field_spaces[0]['nid'] = $nid;

$node->field_spaces[1]['nid'] = $nid;

$node->field_spaces[2]['nid'] = $nid;

$node->field_spaces[3]['nid'] = $nid;

 

automatically as I iterate through things....

 

thank you for any help.

 

cheers,

adam

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.