We help IT Professionals succeed at work.
Get Started

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

GD_GRAY
GD_GRAY asked
on
280 Views
Last Modified: 2013-12-12
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.
Comment
Watch Question
Solution Development Specialist
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE