Q:

How to update a field's value?

Like the field_get_items function, is there a function to update a field's value? I want to update a field of type user reference.

A:

In this example I load a node and change the value of a field called field_context and then saves the updated node:
$node = node_load($nid);
$node->field_context[$node->language][0]['value'] = 'foo';
node_save($node);

Use var_dump to show what fields your node contains.

