Re: Inserting rows with missing IDs

From: Date: Mon, 03 May 2010 16:11:44 +0000
Subject: Re: Inserting rows with missing IDs
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-304881@lists.php.net to get a copy of this message
At 4:34 PM +0300 5/3/10, Andre Polykanine wrote:
Hello everyone, It's not a strictly PHP question, however since I use that with PHP, I'm asking it there. How can I accomplish the task of inserting rows into MySql database with missing IDs? Say, I have rows with IDs 1, 2, 3, 5, 9, 12, 17, and 195. How do I make the check that allows to insert firstly the missing IDs and only then apply the auto-increment? Thanks!
Andre: Why? Why worry about the ID's that are missing? Does your code depend upon the data being in sequential ID's? If so, it's probably not a good idea to do that and you should rethink how you pull your data. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#304881) next »