Page 1 of 1

generate a Serial Number

Posted: Fri Dec 08, 2006 5:23 am
by madhu
Hi all,

Is there any way to generate a Serial Number whenever we execute a php file???

Actually am trying to generate a "transaction id" for implementing payment gateway while registering to a site.

The transaction id shouldbe in this format. WYYYYMMDDXXXXSLN

where W-consatnt , YYYY-Year , MM-Month , DD-day , XXXX -Constant , and the final one SLN is the serial number.

Now i want to generate a serial number for every subscriber.

Eg: for 20061208 (W20061208XXXX001,W20061208XXXX002,W20061208XXXX003,W20061208XXXX004,..........)
for 20061209 (W20061209XXXX001,W20061209XXXX002,W20061209XXXX003,W20061209XXXX004,..........)

Can any body tell, is there any function to generate that SLN(Serial number)???

Waiting for your valuable replies.....

Thanks and regards
MADHU

Posted: Fri Dec 08, 2006 6:48 am
by ok
You need to store the serial numbers somewhere if you don't want to repeat.

Posted: Fri Dec 08, 2006 6:51 am
by m3mn0n
I'd first consider how insecure that system is, and possibly add a change or two so they aren't so easy to guess.

Then, you could simply make your own function for this. There is random number generators & string manipulation functions, but for your own custom format, there isn't exactly always a solution that fits your need the way you want.