Re: Auto Increment Problems....
| From: | Daniel Brunner | Date: | Mon, 29 Jul 2002 20:00:30 +0000 |
| Subject: | Re: Auto Increment Problems.... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-20868@lists.php.net to get a copy of this message | ||
Yeah, it's asked a lot!!
And I've always answered that question....( it's not the only question I answer!!! )
But Good Luck!! And your welcome!!!
Dan
On Monday, July 29, 2002, at 10:51 PM, webmaster@filmfind.tv wrote:
why, is this question asked a lot??? anywa, thanks, i was gonna try something like that from something i read in the mysql manual, but it only mentioned it passing and didnt give an example or anything. tanx "Daniel Brunner" <daniel.brunner@dunidester.com> wrote in message news:CE4D94F0-A32C-11D6-A75E-00306589E6DA@dunidester.com...Once again... ALTER TABLE table1 AUTO_INCREMENT = 500 Dan On Monday, July 29, 2002, at 10:44 PM, webmaster@filmfind.tv wrote:-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.phprite, my primary key column ("id") is set to auto_increment as usual which is very handy. But when I delete a row, the auto_increment just keeps incrementing and there's this 'hole' left where I deleted the row! Apart from this looking ugly, it poses another problem. In my PHP script where I can add new rows, I query the table, checking how many rows in the table altogether and set the new id as the next number, but this doesnt work if theres 'holes' in the id field, as the new record tries to overwrite another id. So I've 2 questions 1) Can the next auto_increment value be 'set' by a SQL query???? 2) Can I get a SQL query to INSERT INTO the first 'hole' it finds in the ID column?? TIA -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php