Load CSV file into Database Table WordPress

As said in my previous question I am having trouble loading data into my table through a csv file. The error I am getting is that the file is not found but it’s there. Could this be a WAMP issue i.e. permissions? You can find the code below along with the error.

Appreciate your help as always:

Read More
function load_table() {
global $wpdb;
$filename = 'upper_db_.csv';
$table_nme = $wpdb->prefix . "upper_winds";
$sql = "LOAD DATA INFILE '" . $filename . "'
INTO TABLE $table_nme
FIELDS TERMINATED BY ',' 
ENCLOSED BY '"' 
ESCAPED BY '"' 
LINES TERMINATED BY 'n'
"; 
$wpdb->query($sql);
}

File ‘c:wampbinmysqlmysql5.6.17datawp-testupper_db_.csv’ not found (Errcode: 2 – No such file or directory)

P.S. I have tried using backslashes, giving full path and I have also tried using the LOAD DATA LOCAL INFILE but to no avail.

Related posts

Leave a Reply

1 comment