How to update content type field programmatically I try to update content type field MYFIELD with code

$update = db_update('field_data_field_MYFIELD')
    -&gt; fields(array('field_MYFIELD_value' =&gt; $result))
    -&gt; condition('entity_id', $nid)
    -&gt; execute();


I see changes in database but they not reflected in node view. Also I applied this code to field_revision_field_MYFIELDtable and got the same result. How can I update MYFIELD programmatically?
It's better to use Drupa API to do that instead of missing with the database directly. you can use field_attach_update to update your field value

$node = node_load($nid);
$field = field_language('node', $node, 'field_your_field');
$node-&gt;field[$field_language][0]['value'] = 'Your New value';
field_attach_update('node', $node);