Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

drupal insert or update DB record with only one function

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?

like image 630
neworld Avatar asked Sep 24 '11 19:09

neworld


1 Answers

Have a look at the db_merge() function, I think it has the features you're looking for.

like image 161
Clive Avatar answered Oct 21 '22 12:10

Clive