I want to import data from Local file(CSV) to Mysql 5.0 table with only selected column.
My PHP code is... as per Mysql5.0 syntax
$query="LOAD DATA LOCAL INFILE '". @mysql_escape_string($tmpupfile) . "' INTO TABLE item_master (item_code,item_desc) FIELDS TERMINATED BY '" . "," ."'";
It gives syntax error.
Following works fine... put column(field) list at the end.
$query="LOAD DATA LOCAL INFILE '". @mysql_escape_string($tmpupfile) . "' INTO TABLE item_master FIELDS TERMINATED BY '" . "," ."' (item_code,item_desc)";
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment