Ver originalmysql_query('aquí va el insert') or die(mysql_error());$lastId = mysql_insert_id($variable_que_guarda_la_conexion_a_la_base_de_datos);