Generate Order Number

That’s what I’ll do. As for formatting the number, here’s what I did…

$id_num = 5;
$order_num = sprintf("NSC-%010d", $id_num);
echo $order_num;

That gives me a number like…

NSC-0000000005

So if the $id_num is 2044 then the zero spaces will account for the larger id number and give me…

NSC-0000002044

Figured I’d post it, in case anyone else needed something similar. Thanks again!

Thanks to wilhud

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: