PHP insert into Access autonumber, get inserted value back?
| From: | Ken | Date: | Wed, 20 Jun 2001 15:46:06 +0000 |
| Subject: | PHP insert into Access autonumber, get inserted value back? | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-9668@lists.php.net to get a copy of this message | ||
I have an Access database that PHP will be accessing. (I'm assuming I have to do this via ODBC
and the Unified ODBC functions in PHP, but correct me if I'm wrong.)
The PHP script will be inserting new records into the Access database.
The primary key in many of the tables in the Access database is an "autonumber" field.
Thus, the key value will be unknown until after I make the insert call.
My question: Either before or after the insert, is there any way for me to find out what the key
value is? I know if I were using MySQL, I could call the mysql_insert_id() function to get this
information.
This is critical to me, because my project entails maintaining a new database (actually, a MySQL
database) that contains the same information as an existing Access database. Changes will be made
to the new database, which then need to be propagated to the Access database. In order for these
databases to remain synchronized, I need the primary keys to be the same in both databases, clearly.
Thanks for any suggestions!
- Ken
kenzo@free-music.com