Page 1 of 1

Help! Run Product Order Number Start with Alphabet

Posted: Thu May 17, 2007 11:03 am
by prasitc2005
Hi All Gurus

Please help me. I would like to do automatic order number which will run from W1000 then it will become W1001, W1002...

I have tried many ways but couldn't insert it into my email order form yet. This is my mess:

Code: Select all

$firstset = 'W1000';
for($i=1;$i<8;++$i) {
$orderid = $firstset+$i;
{
Please suggest some solutions! Thanks!

Posted: Thu May 17, 2007 11:06 am
by JayBird
Ignore the letter W to start with. Generate your number first. Then prefix the number with W

Thank Jay

Posted: Thu May 17, 2007 11:12 am
by prasitc2005
Thank Jay! Could you pls give an example of code. Thanks

Posted: Thu May 17, 2007 11:26 am
by JayBird
How do you keep a track of the order numbers you have already used?

Posted: Thu May 17, 2007 11:29 am
by prasitc2005
Thanks! I have tried to input the result into mysql database but it doesn't go through as there's no form for these.

However, I really need to know first how to generate order number beginning with W1001, W1002 etc. Thanks!

Posted: Thu May 17, 2007 2:47 pm
by thiscatis
If you setup your database first you can query the database for an descending list of order numbers,
limit them to the top result, do the simple $i++ and make it unique.