Re: [PHP-DB] Auto-increment questions...

2004-10-05 Thread John Holmes
NIPP, SCOTT V (SBCSI) wrote: I am working on a database application for Unix user accounts. I want to be able to have a system that will provide me the next available numeric user ID. I have created a 2 column index table that simply includes UID and user name. This field is autoincrement

Re: [PHP-DB] Auto-increment questions...

2004-10-05 Thread Andrew Kreps
On Tue, 5 Oct 2004 14:18:55 -0700, Andrew Kreps <[EMAIL PROTECTED]> wrote: > if (isset ($lastId) && ($lastId < $id - 1)) > { > $returnVal = $lastId + 1; > } Sorry, I left a bit of a bug in there. You should exit the loop at this point, if you've found a gap. -- PHP Database

Re: [PHP-DB] Auto-increment questions...

2004-10-05 Thread Andrew Kreps
On Tue, 5 Oct 2004 12:59:55 -0500, NIPP, SCOTT V (SBCSI) <[EMAIL PROTECTED]> wrote: > OK. The problem is I don't want the next "highest" number. > There are gaps in the UID sequence. I need to find the next UNUSED > number in the sequence which is rarely the "highest" number. As far as I

Re: [PHP-DB] Auto-increment questions...

2004-10-05 Thread Daniel Brunner
number. Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 05, 2004 12:45 PM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: RE: [PHP-DB] Auto-increme

RE: [PHP-DB] Auto-increment questions...

2004-10-05 Thread Hutchins, Richard
essage- > From: NIPP, SCOTT V (SBCSI) [mailto:[EMAIL PROTECTED] > Sent: Tuesday, October 05, 2004 2:00 PM > To: Bastien Koert; [EMAIL PROTECTED] > Subject: RE: [PHP-DB] Auto-increment questions... > > > OK. The problem is I don't want the next "highest&qu

RE: [PHP-DB] Auto-increment questions...

2004-10-05 Thread NIPP, SCOTT V \(SBCSI\)
http:\\ldsa.sbcld.sbc.com -Original Message- From: Bastien Koert [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 05, 2004 12:45 PM To: NIPP, SCOTT V (SBCSI); [EMAIL PROTECTED] Subject: RE: [PHP-DB] Auto-increment questions... If its an autoincrement, the next highest number will be assigne

RE: [PHP-DB] Auto-increment questions...

2004-10-05 Thread Bastien Koert
If its an autoincrement, the next highest number will be assigned by the db. There is no need to query the db to find it. Simply insert the record and leave the id field out of the insert statement. bastien From: "NIPP, SCOTT V (SBCSI)" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Subject: [PHP-