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.

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.mysql-common.inc, line 540
Functions shared between mysql and mysqli database engines.

Code

function db_last_insert_id($table, $field) {
  return db_result(db_query('SELECT LAST_INSERT_ID()'));
}