There is also a LAST_INSERT_ID() function available directly in MySQL. You will find it under "Working with Sequences" in the MySQL documentation. Using the AUTO_INCREMENT capability makes some things easy but you need to be aware of the nature of the beast - that is - it always increases monotonically unless you do something to change that behaviour. For example, you add 10,000 records, then delete them. The next insert has an ID of 10001. Not often a problem, but something to be aware of.
jdtoronto