More than once a colleague asked me the same question, and here is the simplest implementation of PHP. If everyone has a better way, please share:)
The code is as follows:
[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.html www.bkjia.com true http://www.bkjia.com/PHPjc/478007.html techarticle more than once a colleague asked me the same question, and here is the simplest implementation of PHP. If everyone has a better way, please share:) The code is as follows: [PHP]? php $db _host=19 ...