-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

| I am writing a script where I will have 2 insert statements
| The first insert is into a table which has an Auto_Increment field.
| I want to know the value which was inserted in this Auto_increment
field and
| use it in the second INSERT statement.
|
| How can I do it in MySQL.

after inserting into the auto_increment table, do a 'SELECT
LAST_INSERT_ID()' which will return the last autoincremented value. You
can use this value in your second insert statement.

danny

- --

Danny Haworth
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Ge2 System Administrator
Gas~Elec Safety Systems
Tel : 01895 422 997
Email : [EMAIL PROTECTED] (mailto:[EMAIL PROTECTED])
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9iGENUKf+497XC3QRAinfAJ0dgODNkRypaa/5D9R4VA8LAwoalQCfTwnm
YOkwrvwm7ZWfvH8rwVhcDFc=
=k+A3
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to