Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
There are a couple of problems here. The basic problem is that this only tells you what the last ID in the table was (+1), not what the next ID will be. If I insert a record and then delete it, that ID will not be reused, but your solution assumes it will. The next ID will actually be the highest +2. I could do this with any number of records. The other problem is in your second solution:
This selects every row in the table. You really want to select only one:
...but this still suffers from the first problem. In reply to Re^2: How to find the highest number in a mysql table
by kyle
|
|