## db_get_next_free_id

int db_get_next_free_id (string tablename [, string idfield])

Gets the next available id (current id + 1) in a table.

Arguments

tablename is the name of table to be examined.
idfield is the name of identifier field (column). Default is "id".
Result

The function returns the next available id (current id + 1) or NULL if an error occurs. consult

Example

`// Get the next free id in mytable $id = db_get_next_free_id("mytable");`

See also

Database functions
Database support