RE: [PHP] Inserting records in a particular way in MySQL

From: Date: Sun, 16 Feb 2003 20:38:50 +0000
Subject: RE: [PHP] Inserting records in a particular way in MySQL
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-135776@lists.php.net to get a copy of this message
Miles, I never use auto increment. Not because of gaps, but in case I need to reload the table. They do have meaning if they are foreign keys to another table. - Larry -----Original Message----- From: Miles Thompson [mailto:milesthompson@ns.sympatico.ca] Sent: Sunday, February 16, 2003 1:14 PM To: Phillip S. Baker; PHP Email List Subject: Re: [PHP] Inserting records in a particular way in MySQL Phillip, It doesn't matter, obviously you're not using the autoincrement ID for a foreign key. All this does is identify a record. If you did a SELECT and found a missing sequence number, what's to say that value would not be inserted by another user before your INSERT? If you have not set up the table with a MyISAM, MySQL will eventually use the missing numbers. These are only identifying tags, with no intrinsic meaning. Miles At 09:37 AM 2/16/2003 -0800, Phillip S. Baker wrote: >Greetings all, > >I have some PHP code that is inserting records into a DB. >Most of this is auto increment. > >However I know there is allot of breaks in the sequencing. > >I am wondering if there is some way to write the SQL code to search >through the existing records in the DB and to find where the next >available ID is instead of just inserting the next sequence. > >So for example if the ID's are. > >20453 >20454 >20458 >20459 > >It would let me know that 20455 is available for use and use the ID number >instead of using 20460 >Thanks all. > > >Phillip > ><snip overly long sig> > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#135776) next »