Access should also accept standard SQL commands. If not, you can "juggle"
the data by shooting it from Access to a temp table in MySQL and reading the
autonumbered values.

If Access will accept your SQL commands (I don't use Access but maybe
someone else here can offer better information), then simply issue the
appropriate SQL command depending on what you need to do with the new set of
values at that point.

Also, I believe you can control the value in an autonumbered field in Access
so long as there are no duplicates. If this is the case, use the ODBC to
select the value in the last row (i.e.. WHERE COUNT = LAST) and add 1 when
inserting.

Dan


----- Original Message -----
From: "Ken" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 20, 2001 10:46 AM
Subject: [PHP-DB] PHP insert into Access autonumber, get inserted value
back?


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
[EMAIL PROTECTED]


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to