Like this:
$node->field_sup_id[LANGUAGE_NONE] = array( 0 => array('value' => $the_id) );
If your field has several capacities, you can add additional elements, for example:
$node->field_sup_id[LANGUAGE_NONE] = array( 0 => array('value' => $the_id), 1 => array('value' => $other_id) );
And you can use the language
element of the array to determine which language this particular field value refers to:
$lang = $node->language; // Or 'en', 'fr', etc. $node->field_sup_id[$lang] = array( 0 => array('value' => $the_id), 1 => array('value' => $other_id) );
Add them before calling node_save()
, and the contents of the field will be added / updated when you call it.
Clive source share