I have to find the next available id (if there are 5 data in database, I have to get the next available insert place which is 6) in a MySQL database. How can I do that? I h
Given what you said in a comment:
my id coloumn is auto increment i have to get the id and convert it to another base.So i need to get the next id before insert cause converted code will be inserted too.
There is a way to do what you're asking, which is to ask the table what the next inserted row's id will be before you actually insert:
SHOW TABLE STATUS WHERE name = "myTable"
there will be a field in that result set called "Auto_increment" which tells you the next auto increment value.