在PHP中从excel文件导入时,如何将数据插入多个表中 [英] How do I insert the data into multiple tables while importing from excel file in PHP

查看:337
本文介绍了在PHP中从excel文件导入时,如何将数据插入多个表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

像城市和州一样,状态表数据需要插入一次并且与该状态相关,需要在城市表中插入多个城市。但是在插入数据时,它会在状态表中重复状态名称。



我尝试了什么:



试图写多个查询

解决方案

考虑到所有事情,你不应该在一遍中创建多个文件。 />


DO多次通过;在每次传递中创建一种类型的文件。



也许你最好使用邮政地址数据库,听听它的声音。


like city and state are there in states table data need to be inserted once and related to that state multiple cities need to be inserted in the cities table. but while im inserting the data it is repeating the state name in the states table.

What I have tried:

tried to write the multiple queries

解决方案

All things considered, you should NOT create multiple files in ONE pass.

DO make multiple passes; creating ONE type of file in each pass.

Maybe you're better off with a postal address data base, by the sounds of it.


这篇关于在PHP中从excel文件导入时,如何将数据插入多个表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆