Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

returning the results of the previous insert

Status
Not open for further replies.

carpeliam

Programmer
Mar 17, 2000
990
0
0
US
say I run the following insert:

insert into TableName (col1, col2) values (val1, val2);

this is on a table with an AUTO_INCREMENT id field. I want to know the value of ID after I run the insert.

[ol][li]Am I correct in assuming that the only way to do this is to select the row from TableName that has the largest value for id?[/li]
[li]is that method completely reliable?[/li]
[/ol] Liam Morley
lmorley@wpi.edu
"light the deep, and bring silence to the world.
light the world, and bring depth to the silence."
 
I'm confused - is that a PHP function, or a MySQL function? I'm using Java (JDBC)... <p>Liam Morley<br><A HREF="mailto:"></A><br>&quot;light the deep, and bring silence to the world.<br>light the world, and bring depth to the silence.&quot;
 
Outstanding, it works. Thanks :eek:) <p>Liam Morley<br><A HREF="mailto:"></A><br>&quot;light the deep, and bring silence to the world.<br>light the world, and bring depth to the silence.&quot;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top