jbroder
02-18-2000, 02:03 PM
I have a script that adds a row to a table. The table's primary key is an auto_increment field called ID.
As soon as I successfully insert the row, I want to know what the ID is.
The way I've implemented this is to do a separate query based on a field that I just inserted that is unique
(select ID from TABLE where UNIQUE_FIELD = $FieldIJustEntered)
Which means that one field be required unique and that I have to do separate error handling for the 2nd query. Besides this seems like the hard way to do it.
Is there an easier better way to do this?
like
(INSERT INTO TABLE blah, blah, woof, woof, RETURN ID)
thanks for any help...
Jon
------------------
guitartricks.com
As soon as I successfully insert the row, I want to know what the ID is.
The way I've implemented this is to do a separate query based on a field that I just inserted that is unique
(select ID from TABLE where UNIQUE_FIELD = $FieldIJustEntered)
Which means that one field be required unique and that I have to do separate error handling for the 2nd query. Besides this seems like the hard way to do it.
Is there an easier better way to do this?
like
(INSERT INTO TABLE blah, blah, woof, woof, RETURN ID)
thanks for any help...
Jon
------------------
guitartricks.com