-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Thursday 09 October 2003 06:06 pm, Dan Anderson wrote: : Is it possible to SELECT the id (indexed PRIMARY KEY AUTO_INCREMENT) of : a row that was just inserted? I'm using PHP, I don't know if that makes : a difference? : : Something like: : : INSERT INTO foo (bar) VALUES ("bar"); : SELECT last_insert(id) FROM foo; : : Also, are there any problems with using this in an environment where : you're forking processes? : : Thanks in advance, : : -Dan
In php you can use mysql_insert_id() to get the id of the auto_increment column. See http://www.php.net/manual/en/function.mysql-insert-id.php todd[1] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.1 (GNU/Linux) iD8DBQE/hd7v9xvMmfxCaFkRAsoZAJ9eL5aQf0dCHwY/nFdH5vQIny0BrgCgrcI3 V64M7/8+BnyHjJLlzYvG1C4= =MFdB -----END PGP SIGNATURE----- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]