OK...in case anyone else needs to do this, I think I have a workable approach now.
Start off with Table creation and initial number
-- SEQUENTIAL ORDER NUMBER Table
CREATE table orderdata (
ID int(6) unsigned zerofill not null auto_increment, PRIMARY KEY (id),
orderupdated TIMESTAMP,
ordercreated TIMESTAMP,
ordernumber varchar(30)
)
auto_increment = 00000001;
--Start it off with an INSERT
INSERT INTO orderdata (ID,orderupdated,ordercreated,ordernumber)
VALUES(NULL,NULL,NULL,NULL);
;
I'll concatenate the order number with only one "-" and keep date & time together:
SELECT CONCAT(ordercreated,"-",ID) AS ordernumber FROM orderdata;
Finally, I'll update the Table column 'ordernumber' before moving on down the line:
UPDATE orderdata SET ordernumber = '20030909000722-000001' WHERE ID = 1 #test record
The above are all manual via MYSQLCC on the PC, so will need to put everything into PHP/MySQL stuff.
Now, ZZZZZZZZZZzzzzzzzzzzzzzzzzzzzz...