Try mysql_real_escape_string();
mysql_connect("localhost","root","");
mysql_select_db("testdb");
$query="INSERT INTO keywords (id, keyword) VALUES ";
$handle = fopen("Ordlista.txt", "r");
if ($handle) {
$i=1;
while (($line = fgets($handle)) !== false) {
// process the line read.
// echo $line.'<br>';
if($i==1)
{
$query.=" ( NULL , '".mysql_real_escape_string($line)."') ";
$i++;
}
else {
$query.=" ,( NULL , '".mysql_real_escape_string($line)."') ";
}
}
$query.=";";
// $qr=htmlspecialchars($query,ENT_QUOTES);
echo $query;
mysql_query($query);
} else {
echo 'error opening the file.';
// error opening the file.
}
fclose($handle);