Get auto-numbered primary key on insert?
Posted: 15.07.2006, 05:41
Hey all,
I'm inserting a row into a table, the MySQL table has an AUTO_INCREMENT primary key. The problem is, I need to make an insertion into another table which references the first row I inserted, so I need to know what id was generated. How do you solve this? In PHP I'd just use mysql_insert_id().
I'm inserting a row into a table, the MySQL table has an AUTO_INCREMENT primary key. The problem is, I need to make an insertion into another table which references the first row I inserted, so I need to know what id was generated. How do you solve this? In PHP I'd just use mysql_insert_id().