php ran num mysql q
- Started
- Last post
- 6 Responses
- kinetic
i have built an application form that submits info to us. we review that info and then accept or decline.
if we accept...it must insert that users info in the db and genrate a customer number for them
the customer number must be 5 digits in length.
what i need to do is check mysql if that digit exists, if it does, i need to generate a new number...then check again...im having trouble with the flow of this though...not really sure how to do it
is there a built in function for this sort of thing?
thanks in advance :D
- gravityroom0
Just set up the mySQL table to auto-increment the customer ID field...
Then you don't need to even submit a number when you enter something in the database - it will do it automatically
Set the ID in your database to be a 5 digit integer. Also set it to zero fill and auto-increment. Then you're good to go.
- kinetic0
i use auto_incrememnt fields all the time..but i always start at 0
is it possible to set it up to start at a higher number like 1000 and increment from there?
- kinetic0
guess if its the first insert ill make it a thousand...ill check the last inserted row and incrememnt the id by one
- kinetic0
thanks gravityroom
- gravityroom0
You bet. Is it working?
- kinetic0
working like a charm :)