将数据导入mysql的几种方法 [英] How many ways of importing data into mysql

查看:91
本文介绍了将数据导入mysql的几种方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站上有一个页面,供用户插入属性,该页面有54个框.

I have a page in my website which is used for insertion of properties by users which has 54 boxes.

我不希望这些信息直接进入我的数据库,因为如果每天有200条记录,这会使它变得沉重.

I don't want these information should go directly to my database cause it make it heavy if there will be 200 record per day.

我想要的方式是从用户那里收集数据并进行确认,确认后我应该能够导入.

The way i want is to collect the data from users and confirm it, after confirmation i should be able to imported.

我可以知道将数据导入mysql有多少种方法吗?

May i know how many ways are there for importing data into mysql ?

推荐答案

$file = '/pathtocsviportdatabase/csv/importtabledata.csv';

$import = "LOAD DATA LOCAL INFILE '".$file."' INTO TABLE `imports` FIELDS TERMINATED BY ','
  OPTIONALLY ENCLOSED BY '\"' 
  LINES TERMINATED BY '\n' 
  (AllCOLUMN SEparated by ',');";
mysql_query($import) or die(mysql_error());

这篇关于将数据导入mysql的几种方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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