[UPHPU] mySQL Primary Keys
jacdx at jacobhanson.com
Tue Jun 29 23:16:11 MDT 2004
Tuesday, June 29, 2004, 10:51:27 PM, you wrote:
> LAST_INSERT_ID() and/or mysql_insert_id() will work for you.
> According to the MySQL Manual they are only affected by the current
> client connection. They won't be affected by other users.
> If you're id is autoincremented you do your insert statement and then
> something like:
> $mynewID = LAST_INSERT_ID();
> Try reading the following:
That's right, good catch David. The issues I mentioned only apply in
environments that persist connections, and aren't normally used
Note that LAST_INSERT_ID() is a MySQL function, so it works in a
query instead of PHP code.
More information about the UPHPU