When I am importing from CSV, it is showing me characters like ???
My DB and tables are aleady set to utf8 unicode ci and arabic and other data shows proper
Could you please check if your column's collation is also UTF8 unicode?
You can run mysql> show full columns from employees;
and check the output to make sure even the column's collation is able to accept UTF8.
EDIT CSV can't store UTF-8 data unless the UTF-8 Byte Order Mark (BOM) is set.
I don't know if the CSV you are saving is retaining the UTF-8 characters. Maybe you should try opening the CSV in noteapd and see if you get the characters properly.
EDIT2 I just modified the code to have it read the CSV properly and the form has a new accept attribute.
CSV Should be in Below Format:
Full Name: Employee Number: Department: Email:
query("INSERT INTO employees (first_name, emp_number,department,email) VALUES ('".$name."','".$emp_number."','".$department."','".$email."')");
$c = $c + 1;
}
if($sql){
echo "You database has imported successfully. You have inserted ". $c ." Records";
echo '← View Inserted Records ';
}else{
echo "Sorry! There is some problem.
".$link->error;
}
}
?>