时间:2021-07-01 10:21:17 帮助过:65人阅读
代码如下:
[php]
$db_host="192.168.1.10";
$db_user="root";
$db_psw="11111";
$db_name="csvimport";
$conn = mysql_connect($db_host,$db_user,$db_psw) or die("Connection occur error");
mysql_select_db($db_name,$conn) or die("Connection occur error");
mysql_query("set names utf-8");
mysql_query("LOAD DATA INFILE '/root/bill20120813121249.csv' INTO TABLE `billdata` FIELDS TERMINATED BY ',' ENCLOSED BY '\"' ESCAPED BY '\"' LINES TERMINATED BY '\r\n' IGNORE 1 LINES;") or die ('Error: '.mysql_error ());
?>
http://www.bkjia.com/PHPjc/478007.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478007.htmlTechArticle不止一次有同事问我同样的问题了,在这里提供一种PHP最简单的实现。如果大家有更好的方式,请分享:) 代码如下: [php] ?php $db_host=19...