I don't see a Drupal function comparable to mysql_insert_id. Obviously using the command would mean PostgreSQL wouldn't work (would it?)... so I'm curious if instead of using mysql_insert_id after an insert I should use db_next_id before the insert to store the next insert's id.


budda’s picture

You want a sequence, use db_next_id.

Ixis (UK) providing Drupal consultancy and Drupal theme design.

rszrama’s picture

Will do, thanks much.

Current Drupal project: http://www.ubercart.org

kjarli’s picture

Lol no dont.. What if your record has id 8012, someone posts something, meaning his record gets 8013 right before you select the id, means you get 8013, resulting in linking or updating to the wrong record...