Importing CSV into database table not working?
global $wpdb;
if (isset($_POST["import"])) {
$fileName = $_FILES["file"]["tmp_name"];
if ($_FILES["file"]["size"] 0) {
$file = fopen($fileName, "r");
while (($column = fgetcsv($file, 10000, ",")) !== FALSE) {
$table_name = 'sas' ;
$wpdb-insert(
$table_name,
array(
'category' = '" . $column[0] . "',
'temple' = '" . $column[0] . "'
)
);
}
}
}
I want to import csv directly into the core wordpress database table 'sas' .The csv contains some records with the structure of the table i have created...But the import is not successfull..