<?php
$q["0"]    =    'localhost';
$q["1"]    =    'root';        // benutzername
$q["2"]    =    'Marie62743';         // passwort
$q["3"]    =    'testchat';    // datenbank
mysql_select_db($q["3"],mysql_connect($q["0"],$q["1"],$q["2"]));

$cel = file("03.txt");
$add = "0";
foreach($cel as $key => $value) {
if ($value) {
$value = str_replace("'","`", $value);
$woerter = strlen(trim($value)) - strlen(str_replace(" ", "", trim($value)))+1; // zählt die wörter
$ex = mysql_fetch_array(mysql_query("SELECT * FROM `wordmix` WHERE `SENTENCE` = '".trim($value)."'"));
if ($woerter <= '10' && !$ex["SENTENCE"] && strlen(trim($value)) >= '3') {
$add++;
mysql_query("insert into wordmix set `SENTENCE` = '".trim($value)."'");
}
}
} 
echo 'Sätze importiert: '.$add;
?>
