Skip to content

Instantly share code, notes, and snippets.

@nucklearproject
Created September 20, 2012 20:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nucklearproject/3758096 to your computer and use it in GitHub Desktop.
Save nucklearproject/3758096 to your computer and use it in GitHub Desktop.
CCK field Update with drupal_write_record()
File created in webroot.
<?php
error_reporting(E_ALL);
require_once 'includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
drupal_flush_all_caches();
$results = db_query('select nid from node where type="store"');
while ($result = db_fetch_object($results)) {
print "campo " . $result->nid . "<br>";
$record = array('field_dealer_distributor_value' => 'dealer', 'nid' => $result->nid, 'vid' => $result->nid);
drupal_write_record('content_type_store', $record);
}
drupal_flush_all_caches();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment