Gets the next available id (current id + 1) in a table.
int db_get_next_free_id(string tablename [, string idfield])
The function returns the next available id (current id + 1) or NULL if an error occurs.
// Get the the next free id in mytable
$id = db_get_next_free_id("mytable");