Likely to be a problem with SQL rather than reading the csv.
You may need to use mysql_real_escape_string() on data items - you could use array_map for this. I'm assuming you have a variation on the following:
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
{
//this line added
$data = array_map("mysql_real_escape_string",$data);
$sql = "INSERT into users(name,lastname,email) values('$data[0]','$data[1]','$data[2]')";
mysql_query($sql) or die(mysql_error());
}
diafol
Keep Smiling
10,654 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,510
Skill Endorsements: 57
Question Answered as of 10 Months Ago by
diafol