Click to See Complete Forum and Search --> : unique order ID


renevanh
08-27-2006, 03:46 AM
I'm (still) building a website where people can order things.
I want to give every costumer who pushed the "order" button a unique ID. Is there a nice PHP trick to do this, or should I use a database to keep track of the ID's already given?

René

ronverdonk
08-27-2006, 07:26 AM
Use PHP function mt_rand() or generate your own based on date and time.
Then store it in the user's $_SESSION['transid'] (or whatever name you come up with) variable.

Ronald :cool:

Sid3335
08-27-2006, 07:49 AM
If you are creating an eccomerce application you will want to store all orders in a db anyway, so it makes more sense to do it via a db. perhaps allowing customers to sign up and store details for quicker ordering.

then just use an auto increment field to store the customers, giving a unique id for each customer that signs up.