Tag Archives: db_merge

How to retrieve last MySQL INSERT ID from Drupal 7 db_merge()

Drupal 7′s DBTNG database abstraction layer introduces the db_merge() command which replaces the if($id) { db_update() } else { db_insert() } construct. Very useful. One issue I ran into is retrieving the last MySQL insert ID. db_insert() returns the ID … Continue reading

2 Comments

Filed under Code