Link to home
Start Free TrialLog in
Avatar of GD_GRAY
GD_GRAYFlag for United States of America

asked on

How would I get mysql to generate a 4 digit number and never use it again

How would I get mysql to generate a 4 digit number and never use it again if it finds it in the db.I need to auto put an invoice number into a form so that once the form is posted into the data base I can run queries for the data on that invoice. I use a random number java script right now but sooner or later its going to bonk on me. The field for the invoice number is set to unique so when that happens its going to stop the insert statement and the user will have to start over... Not good I thought maybe a table full of 4 digit numbers for it to pull from but I don't know how to mark it as used so it wont get the same one twice.
ASKER CERTIFIED SOLUTION
Avatar of Neil Russell
Neil Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of GD_GRAY

ASKER

That was it, thank you. I just set it to run the update before it pulled the number.... LoL why did I not think of that......LoL Thanks for your help.