You are here

function db_last_insert_id in Drupal 6

Same name in this branch
  1. 6 includes/database.mysql-common.inc \db_last_insert_id()
  2. 6 includes/database.pgsql.inc \db_last_insert_id()

Returns the last insert id. This function is thread safe.

Parameters

$table: The name of the table you inserted into.

$field: The name of the autoincrement field.

Related topics

11 calls to db_last_insert_id()
actions_save in includes/actions.inc
Save an action and its associated user-supplied parameter values to the database.
aggregator_save_category in modules/aggregator/aggregator.module
Add/edit/delete aggregator categories.
aggregator_save_feed in modules/aggregator/aggregator.module
Add/edit/delete an aggregator feed.
aggregator_save_item in modules/aggregator/aggregator.module
Add/edit/delete an aggregator item.
batch_process in includes/form.inc
Processes the batch.

... See full list

File

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

Code

function db_last_insert_id($table, $field) {
  return db_result(db_query("SELECT CURRVAL('{" . db_escape_table($table) . "}_" . db_escape_table($field) . "_seq')"));
}