My scenario is saving an image to a folder. Why I am using id is I have to save a lot of items(images, pdf) into the same folder as it is all related to this item. When new data is created I want to save the file in that data id -> for supposing I have already 4 items then added fifth then I can check total rows and increment 1 and make a folder. But suppose I deleted the fifth item and adding another item so the primary key - unique id to be saved in DB will be 6 and not five. I can use


and get id by


but not preferred as it might get delay/error in saving then already the values will be saved and the files will not be. I used the following but it is all returning null values


Is there any method to get the next id to be saved in table.

EDIT: IS there any method to get the same. Send a reply ASAP as i am stuck with it for past 2 days.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.