I have a PHP script that INSERTs a new record with a key called 'ID'. The key is an auto_increment field. After the INSERT is performed, I would like to offer the web visitor the opportunity to modify or add to the record - - so I need to pass the ID value on to the next operation. Is there a simple trick to SELECT or obtain the ID that was just INSERTed so that more operations can be performed?
Should I simply
SELECT ID from mytable ORDER BY ID DESC LIMIT 0, 1
to get the most recent ID key or is there a better way to do this?
- - picklefish - -
Should I simply
SELECT ID from mytable ORDER BY ID DESC LIMIT 0, 1
to get the most recent ID key or is there a better way to do this?
- - picklefish - -