usar SELECT LAST_INSERT_ID(); http://dev.mysql .com/doc/refman/5.0/en/information-functions.html#function_last-insert-id