db_next_id

5 database.mysql.inc db_next_id($name)
5 database.mysqli.inc db_next_id($name)
5 database.pgsql.inc db_next_id($name)
7 database.inc db_next_id($existing_id = 0)
8 database.inc db_next_id($existing_id = 0)

Return a new unique ID in the given sequence.

For compatibility reasons, Drupal does not use auto-numbered fields in its database tables. Instead, this function is used to return a new unique ID of the type requested. If necessary, a new sequence with the given name will be created.

Related topics

15 calls to db_next_id()

File

includes/database.pgsql.inc, line 199
Database interface code for PostgreSQL database servers.

Code

function db_next_id($name) {
  $id = db_result(db_query("SELECT nextval('%s_seq')", db_prefix_tables($name)));
  return $id;
}
Login or register to post comments