How to programmatically delete all values in custom CCK field for a given node? I'm on Drupal 6, and I have a multiple value CCK field. I need a PHP function to delete all the values in that field so I can later repopulate it. I am currently doing this:

if (isset($node-&gt;field_received_email[0]['value'])) {
  foreach($node-&gt;field_received_email as $key =&gt; $value) {
    $node-&gt;field_received_email[$key]['value'] = NULL;
  }
}


However, sometimes when I later repopulate it, I get Drupal dblog errors like:


  Duplicate entry &#039;16026-133&#039; for key &#039;PRIMARY&#039;
  query: INSERT INTO content_field_received_email (vid, nid, delta,
  field_received_email_value) VALUES (16026, 15888, 133,
  &#039;whatever@email.com&#039;)


It appears that the primary key is remaining, and so when I go to write data again to the field it gives the duplicate primary key error. 

Any suggestions on how to really delete all the values and keys from a multiple value CCK field in a given node so I can later re-write them?

Thanks a lot!
Try to unset item

if (isset($node-&gt;field_received_email[0]['value'])) {
  foreach($node-&gt;field_received_email as $key =&gt; $value) {
    unset($node-&gt;field_received_email[$key]);
  }
}