lexipixel - 8:58 pm on Mar 10, 2013 (gmt 0)
When I need a unique incremental number I concatenate a time/date stamp with the user's remote IP, (and always left-pad each octet with zeros to form a fixed length string).
Take for example March 10, 2013 at 4:15:30pm and a user from "92.256.3.299"
YYYYMMDDhhmmss = 20130310161530 (24hr "military" time with each fragment left-padded with zeros)
IP = 92.256.3.299
w/ left zero padded octets = 092.256.003.299
Remove dots = 092256003299
Concatenate "20130310161530" and "092256003299" and you now have sortable, unique, incremental string of numbers: 20130310161530092256003299
Since the most significant "bits" are to the left, and all are fixed length, they will sort chronologically, (the mathematical value of the IP address is the least significant part of the number and should have little consequence on sorting).
No look-ups, no disk writes, no storage needed!
(NOTE: Yes. I do know IP address octets can only go to "255" -- the "256" and "299" are to anonymize my example)