damien275x Posted May 26, 2012 Share Posted May 26, 2012 Hi, I am looking to use PHP to create a unique order number. I can't be bothered linking to a database etc, I am thinking creating a string of 10 characters based on current time down to the second plus a random number, or something based on the users IP address? Reduce the chances/odds someone has the exact same number. It's for a small system. Can anyone help me? I want it to be about 8-10 numbers. like 20120403xxxx where xxxx is the random numbers based on IP or a random digits. Thanks everyone Quote Link to comment Share on other sites More sharing options...
Jessica Posted May 26, 2012 Share Posted May 26, 2012 considering a timestamp is 10 digits, you could just use time(); Quote Link to comment Share on other sites More sharing options...
damien275x Posted May 26, 2012 Author Share Posted May 26, 2012 Thanks, but also as users could access the page at exactly the same time, they may have the same ID for their order Can I + something to the timestamp? Reduces the odds to the point where I think i'd be OK with it Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.