Drupal database api delta
Question
I am working on a module which directly updates the data of a set CCK taxonomy checkboxs via ajax.
Everything is working with the exception of the saving to database. Using the following code:
$data = array(
'vid' => $nid,
'nid' => $nid,
'field_grouping_value' => $tid
);
drupal_write_record('content_field_grouping', $data);
I get error messages which complain I am dublicating the value of the 'delta' field. My problem is the code is attempting to write my new data but the delta field is a joint key which does not auto-increament.
Ordinarily, I would just increment the delta field but Drupal handles it so dynamically I'm worried I will do more harm than good:
http://i.stack.imgur.com/yTwoN.gif">
If nid 3 had another field in the above image, it's delta field will have a value of 2. I then delete the field with nid of 3 and delta of 0. Instead of being left with the delta field of values 1 and 2, everything gets reset to 0 and 1
Just so I don't damage my site, I wonder if anyone can advice how I can resolve this issue and get Drupal to dynamically deal with the delta field ..... or is it unnecessary ????
No correct solution