Sv: [PHP-DB] MySQL Identity Field
| From: | Freddy Kristiansen | Date: | Fri, 21 Jul 2000 20:48:02 +0000 |
| Subject: | Sv: [PHP-DB] MySQL Identity Field | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-1413@lists.php.net to get a copy of this message | ||
> Something like
> create table tablename (id int(8) unsigned auto_increment);
Typically you want a key on that ID:
ID int(9) DEFAULT '0' NOT NULL auto_increment
And then - after inserting into this table you can use:
select LAST_INSERT_ID();
to get the ID created bye the last insert to a table within the MySQL
connection..,..
Nice feature !
Freddy