I have a cck field in a node. I bring this value out in some other form and alter its value, But i am unable to save it back to DB. How should i write it back to table such that node changed date also gets changed. please show some code for this.

2 Answers 2


You can use node_save() to do this; CCK will automatically hook into it and update the field values in the database for you:

// Load a node
$node = node_load(1);

// Update the field value
$node->field_field_name = array(0 => array('value' => 'A value'));

// Save the node. Field values are also saved, and the node modified time is updated.

You should try with hook_nodeapi(&$node, $op, ...) with $op='presave'.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.