|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Auto Increment Question
Is there a way to query what the next auto_increment number will be?
|
|
#2
|
|||
|
|||
|
RE: Auto Increment Question
are you talkin like..
for($i=0; $i<100; $i+=2) ??.. you musn't be.. hmm too simple. |
|
#3
|
|||
|
|||
|
RE: Auto Increment Question
No, I was vague in my question. In MySql. I need to know what the next auto_incement number will increment to. I am going to move this to database help
|
|
#4
|
|||
|
|||
|
RE: Auto Increment Question
select LAST_INSERT_ID();
|
|
#5
|
|||
|
|||
|
RE: Auto Increment Question
and then add 1.
|
|
#6
|
|||
|
|||
|
RE: Auto Increment Question
I don't know of a definate way to get the next ID. Even if you could, you would run into problems because you couldn't place a lock on it. Who's to say that between the time you get it and the time you use it, it hasn't been used already?
That being said is there a special reason you need it before hand? Would getting it after an insert work? |
|
#7
|
|||
|
|||
|
RE: Auto Increment Question
Another possibility is to use the PEAR DB class, it allows you to create sequences and find out the next sequence before using it....
http://pear.php.net/ |
|
#8
|
|||
|
|||
|
RE: Auto Increment Question
I just thought it would be nice to display the invoice# at the as they were taking the order on the phone. I also wanted to use the number within a app that has the id+an incrementing run number at date for tracking of production runs
|
|
#9
|
|||
|
|||
|
RE: Auto Increment Question
I would insert a dummy record, then update that record with the information from the order. That way, you get a lock on the invoice number and you know it isn't going to change.....
|
|
#10
|
|||||
|
|||||
|
RE: Auto Increment Question
php Code:
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Auto Increment Question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|