Re: 2 Questions.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 13, 2008 at 8:14 PM, tedd <tedd.sperling@xxxxxxxxx> wrote:
>
> While you might think an order number should be something else, keep in mind
> that an order is simply an order. It is a point in time where a customer has
> agreed to purchase something and you have accepted and have cleared that
> purchase for that payment through some sort of purchasing scheme.

    One of the best schemes for developing a unique order number that
is not only unique to the system, but is also readily human-readable
would be to use an auto_increment value appended to a date string.
For example:

<?php

$today = date("Ymd");

$increment = $numberFromDB; // This routine would depend on your
database (MySQL, PostgreSQL, etc.)

$orderNumber = $today."-".$increment;

?>

    From the above, you'd get an order number similar to 20080913-1048.

    This means that it's not only unique, regardless of how many
orders come through in the same second, but ordering by time and date
is easier, and on paper, you can easily tell when an order was placed.

-- 
</Daniel P. Brown>
More full-root dedicated server packages:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Intel 2.4GHz/320/GB/1GB/3TB $74.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux