| Versionen | |
|---|---|
| drupal6 – drupal7 | db_last_insert_id($table, $field) |
Returns the last insert id. This function is thread safe.
$table The name of the table you inserted into.
$field The name of the autoincrement field.
includes/
<?php
function db_last_insert_id($table, $field) {
return db_result(db_query("SELECT CURRVAL('{" . db_escape_table($table) . "}_" . db_escape_table($field) . "_seq')"));
}
?>
Kommentare
Kommentar hinzufügen