auto_increment problem???
| From: | Russ | Date: | Fri, 23 Aug 2002 09:29:05 +0000 |
| Subject: | auto_increment problem??? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-21323@lists.php.net to get a copy of this message | ||
G'day folks:
The way I have my MySQL table set up should work as follows:
1). If table IS NOT empty, get MySQL to insert auto_increment value into
primary key column as normal, then get value of previous record's
second, none primary ID column. (latter column used for lookup purposes
elsewhere)
(This is do-able as there is already an existing record from which to
gather a second none-primary ID.)
2). If table IS empty, insert auto_increment value as normal, into
primary key column and *the same value* into the second, none-primary ID
column.
The thing is, as I'm using auto_increment as my primary key definition,
and occassionally this table is emptied (deleted from), how can I get
the second none primary ID column to reflect the new primary key
auto_increment value of a new record, if no previous record exists??
I hope you understand what I mean! ;-)
Cheers.
Russ
Mr Russ Michell
Web Applications Developer
Itomic.com
Email: russ@itomic.com
Tel: +61 (0)8 9321 3844
Fax: +61 (0)8 6210 1364
Post: PO Box 228, Innaloo, WA 6918, Australia
Street: Suite 24, 158 William St, Perth, WA 6000, Australia
"No proof of existence is not proof of non-existence."
(Physicist: Stanton T. Friedman on Debunking Ufology)