I need some advice

Discussion in 'PHP' started by baris22, Jul 20, 2009.

  1. #1
    hello,

    I need some advice. This is my sql table

    order
    #order_id
    #order_reference_number
    #customer_id
    ...
    ....


    order reference number is the number i need to give to customer. it needs to be a number. when it comes to 9999 it needs to start from 1 again.

    how can i do this? what is the easiest way?

    Thanks
     
    baris22, Jul 20, 2009 IP
  2. mioot

    mioot Peon

    Messages:
    169
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Before inserting the order into table u need to select max(order_reference_number) if the number is 9998 means. u add (9998 + 1) . After that insert the order.

    When you want to insert the next order. These time u selecting max(order_reference_number) if the number is 9999 means. u simply start from (1) and insert order.
     
    mioot, Jul 21, 2009 IP