Re: Auto Increment Problems....
| From: | Bas Jobsen | Date: | Mon, 29 Jul 2002 20:34:34 +0000 |
| Subject: | Re: Auto Increment Problems.... | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-20871@lists.php.net to get a copy of this message | ||
Op dinsdag 30 juli 2002 05:44, schreef Georgie Casey:
> So I've 2 questions
INSERT TABLE id values('');
leave it empty
> 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??
I don't think so. You can mark the row, when you delete it.
Make the field mark (or you a field you already have) b.e small int (1)
In stead of deleting, you insert empty values and set mark to 1
If you insert a row, you need a extra query:
SELECT id where mark=1 SORT BY id ASC
If no row found insert with id (see above) else use the id found;
UPDATE TABLE SET i mark='0'............. WHERE id='$first_ID_with_mark_is_1'