Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

During Registration


geozerocool

Recommended Posts

Posted

Hello People, I hope this time i get some help on this support forum :)

 

So what is my question can you help me add this kind of option :

 

When user registers i need this user to get Some uniqque Random 6 digit ID this ID should be stored in databse for example in customers table in a new field customers_number

 

can you help me with this every user should get this 6 digit numbers

Posted

You already have such a number in your database. It's the customers_id. Set it manually to a six digit number and any new customer will get the next higher one. Problem with your attempt to give any customer a random number is that you have to check the database any time the number is created if the number already exists. If so, a new number has to be created and so on. Assuming you won't have millions of customers, the computing time won't be too long, but you can save the time for programming this feature and let the database do it.

Posted

If you need a truly random number, such as for a prize drawing, and the predictable sequence of customer IDs won't do, you could generate a number using the rand() or mt_rand() function. However, as Manfred pointed out, you will need to check this number against all other such numbers you've generated (and stored) to prevent duplicates.

Posted

yes actually both you are right i did it with random now i check this number and do the same random until the variable won't gets unique number that was my solution

 

 

but if you can tell me how to increase Customer_Id to 6 digit ?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...