$sql = "INSERT INTO person VALUES ('Carter','Thomas','Beijing')";$result = mysql_query($sql); //执行插入echo mysql_insert_id(); //获取上一步插入的ID