I'm using drupal_write_record to update records in the database in Drupal 6, but it appears to skip null values entered into my integer fields and just leave the old value. I've also tried the string "NULL" with no success. Regular integer values work fine.

$record = array(
  'id' => ##my_id##,
  'int_field' => null
drupal_write_record('my_table_name', $record, array('id'));

How can I change 'int_field' back to NULL from an existing value?

1 Answer 1


does this patch suite your needs? http://drupal.org/node/227677#comment-4302522

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.