<?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 ()); ?>
form :http://blog.csdn.net/faye0412/article/details/7886153
int ftell(resource handle) //返回文件指针的当前位置
int fseek(resource hanlde,int offset[,int whence]) //移动文件指针到指定位置
bool rewind(resource handle) //移动文件指针到文件的开头