I have 1 content type and one cck text field. if i create node and enter title and text field data and click to save save button its create node and enter data into node and content_field_table perfectly, but if i update cck field data manually into database its not shows update node data.

3 Answers 3


I can't say I'd advise manually inserting data into the database (there are a lot of API functions for CCK that will help you to do this), but that's for another question.

To make sure the node is reloaded from the database after you've inserted your record(s) just run this code:

$node = node_load($node->nid, NULL, TRUE);

The third argument to the function is $reset, which if TRUE will force the node to be built again from the database, not from the static cache.


Have you tried clearing the cache? A lot of things in drupal are being cached, so editing/removing them from their database table might give a conflict with what's in the cache.


I needed to do the same thing in Drupal 6, but ran into issues with the CCK Cache not clearing. I dug into the CCK Module code, and found the method they used:

cache_clear_all('content:'. $node->nid .':'. $node->vid, content_cache_tablename());

You can find details on cache_clear_all() here.

If you use this method, then your manual update code should look like this:

db_query("UPDATE `content_type_$type` SET field_$type_$fieldname_value='%s' WHERE nid=%d AND vid=%d",$node->fieldname[0]['value'], $node->nid, $node->vid);
cache_clear_all('content:'. $node->nid .':'. $node->vid, content_cache_tablename());

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.