similar quest is here: Help with db query in drupal - if exists update else insert
But drupal_write_record() third argument is to determine update or insert. Maybe drupal has another function, who self determine insert or update by primary key? Or I should it to program my self?
Have a look at the db_merge() function, I think it has the features you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With