I am working on a web application. It will have multiple users. I am using mysql as database. 

In my application i am fetching the latest `id (from the database, using max(id))` , and then generating the next id for the new registration. This approach is incorrect, as the id might change between the time i update an id 
and i ask for the latest id. I googled up , and found `"last_insert_id()"` 

But, i tried `"SELECT last_insert_id() FROM rdtype "`, but its gives the same number of 0 as the no of records. 

How should i proceed?