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->field_received_email[0]['value'])) {
foreach($node->field_received_email as $key => $value) {
$node->field_received_email[$key]['value'] = NULL;
}
}
However, sometimes when I later repopulate it, I get Drupal dblog errors like:
Duplicate entry '16026-133' for key 'PRIMARY' query: INSERT INTO content_field_received_email (vid, nid, delta, field_received_email_value) VALUES (16026, 15888, 133, '[email protected]')
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!