[need help] mysql question [modified]
-
hi all, i'm creating a site using php and a mysql database. i have a query that will look something like
INSERT INTO table (value1, value2) VALUES ('...', '...')
. the table 'table
' has an auto-increment int 'id
' field. how can i get theid
of the row i just inserted, withoutSELECT
ing the row usingWHERE value1='...' AND value2='...'
? thanks in advance. -- modified at 10:10 Sunday 20th August, 2006 -
hi all, i'm creating a site using php and a mysql database. i have a query that will look something like
INSERT INTO table (value1, value2) VALUES ('...', '...')
. the table 'table
' has an auto-increment int 'id
' field. how can i get theid
of the row i just inserted, withoutSELECT
ing the row usingWHERE value1='...' AND value2='...'
? thanks in advance. -- modified at 10:10 Sunday 20th August, 2006 -
Use the query "select last_insert_id()" on the same connection that you used to insert the record, and you get the id.
--- b { font-weight: normal; }
i just did a search on "last_insert_id" and found this: http://us3.php.net/manual/en/function.mysql-insert-id.php thanks for the reply!