How to select the last insert id from database table
i need to get the last insert id from database
i try the last_insert_id()
function but this doesn't work for me because i want to get this id before i do an insert query and when i get this id i do an insert query
i try to use max
for the id but this have a problem that if i have a deleted
id it will not be taken
example if i have id 10 deleted than the max id will be 9 but the auto increment will be 11
than i want to have the new id that will be added by the auto increment
example:i have an id 10 deleted i want to take than next id it will be 11