我有一个 'location' 表和一个 'location_detail' [用于插入不同语言数据] 表。'location_detail' 包含位置表的 FK
我需要一次输入多个位置。所以我正在做的是:
在其中运行一个“for”循环,首先我将数据输入到“location”表中获取 loc_id,然后插入到 location_detail 表中[如果存在多种语言,则在“location_detail”表中,我想再次运行查询多次]。
因此,如果我想添加 3 个位置 -> 外部“for”循环将运行 3 次查询执行总数。是 6 [如果存在一种以上的语言,这将是多种语言]
==>我的目标是在单个语句中使用多次插入将所有 3 个(比如说)位置插入到“位置”表中,并获得所有 3 个 last_insert_ids。
==>接下来我可以运行单个语句多个插入查询以添加到“location_details”表中
在这里,我将如何在数组中获取这个 last_insert_ids?