why not using systime... itīs then not a following number but really unique
if you are using mysql too you could insert the systime to a table, second coloumn with auto increment value then you have a following unique number (maybe also possible with sqlite or nvault, i donīt know)