Jump to content

Return a MySQL value on Insert


dan400007

Recommended Posts

Hi, I want to insert a record into a mysql table and then have it return ID for the record just entered.  Example of what I want to happen is below:

table:
ID mediumint( 8 ) Auto-increment unsigned not null
col1 text
col2 text

INSERT INTO table (col1, col2) VALUES ('This is col1', 'This is col2');

When the insert occurs I want mysql to return the ID for the record it just inserted, is this possible?

Thanks, Dan
Link to comment
https://forums.phpfreaks.com/topic/27521-return-a-mysql-value-on-insert/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.