badHabitZ
07-28-2010, 06:25 PM
Hey people,
I am in need of some help, I have tried all sorts of things, but I'm new so I don't know much. I've got a customer database, and I need a unique customer ID each time I insert a new customer into the database, and it needs to look like this:
2010290701
2010290702
2010290703
The first bit is today's date, and the bold stuff is the unique number I will be getting. So if I insert 10 customers today, the last customer ID will be:
2010290710
I will NOT be inserting more than 99 customers each day, so this is not a problem. But I need the script to check if today's date already exists, if so, check which number was used last, and then add a new number plus 1. So, if the following ID was used last -> 2010290703 -> Then the next ID would be this number plus one, so it would become -> 2010290704
If today's date has NOT been used yet, it needs to be today's date with 01 at the end.
Hopefully someone understands and can point me in the right direction so I can fix this finally :)
Thanks in advance for the help!
I am in need of some help, I have tried all sorts of things, but I'm new so I don't know much. I've got a customer database, and I need a unique customer ID each time I insert a new customer into the database, and it needs to look like this:
2010290701
2010290702
2010290703
The first bit is today's date, and the bold stuff is the unique number I will be getting. So if I insert 10 customers today, the last customer ID will be:
2010290710
I will NOT be inserting more than 99 customers each day, so this is not a problem. But I need the script to check if today's date already exists, if so, check which number was used last, and then add a new number plus 1. So, if the following ID was used last -> 2010290703 -> Then the next ID would be this number plus one, so it would become -> 2010290704
If today's date has NOT been used yet, it needs to be today's date with 01 at the end.
Hopefully someone understands and can point me in the right direction so I can fix this finally :)
Thanks in advance for the help!