Jump to content

flaquito

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Everything posted by flaquito

  1. [quote author=anatak link=topic=123788.msg512094#msg512094 date=1169623676] Hello, Is there a function to get the value of an autoincrement (or any field) back after inserting a new row ? example INSERT INTO tbl_name (col2,col3) VALUES(firstname, lastname); col1 is an autoincrement. How can you get the value of col1 of the new row back ? kind regards anatak [/quote] Have a look at [code]SELECT LAST_INSERT_ID()[/code] You don't have to return the entire table (?!?), and it's connection based, so you don't have to worry about race conditions. Check the documentation at [url=http://href=http://dev.mysql.com/doc/refman/5.0/en/information-functions.html]href=http://dev.mysql.com/doc/refman/5.0/en/information-functions.html[/url], about halfway down the page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.