Hi All,
I have a strange problem which keeps occurring every now and then for no apparent reason.
I have a simple table which generates a unique order number for each order:
CREATE TABLE order_numbers(order_no int(5) not null auto_increment primary key);
In my PHP code I have:
mysql_query("INSERT INTO order_numbers VALUES('')");
Then I use mysql_insert_id() to assign the order number to the transaction.
This all works fine most of the time, however sometimes a number is missed out of the table ie/
order_no
24
25
27
28
29
What is happening is that months later this missing number (26) is then used as an order number. This has the effect of assigning an earlier order number to a recent order??
Why does this happen?
Any ideas would be much appreciated.
Hope this makes sense
Mike
I have a strange problem which keeps occurring every now and then for no apparent reason.
I have a simple table which generates a unique order number for each order:
CREATE TABLE order_numbers(order_no int(5) not null auto_increment primary key);
In my PHP code I have:
mysql_query("INSERT INTO order_numbers VALUES('')");
Then I use mysql_insert_id() to assign the order number to the transaction.
This all works fine most of the time, however sometimes a number is missed out of the table ie/
order_no
24
25
27
28
29
What is happening is that months later this missing number (26) is then used as an order number. This has the effect of assigning an earlier order number to a recent order??
Why does this happen?
Any ideas would be much appreciated.
Hope this makes sense
Mike