mehrere Datenbanken
This commit is contained in:
parent
1d6620f4da
commit
c93674f9f6
1 changed files with 30 additions and 12 deletions
42
main.php
42
main.php
|
@ -13,24 +13,42 @@ $falscheswort ="langes wort";
|
||||||
if(isset($_GET["wort"])) {
|
if(isset($_GET["wort"])) {
|
||||||
$falscheswort =$_GET["wort"];
|
$falscheswort =$_GET["wort"];
|
||||||
}
|
}
|
||||||
require_once 'verbindungsaufbau.php';
|
$tabellen = array();
|
||||||
$vorhanden = $mysqli->query("SELECT id FROM `unileipzig-en`,`unileipzig-de` WHERE wort='$falscheswort'");
|
if(isset($_GET["ul-de"])) {
|
||||||
if($vorhanden->num_rows ==1) {
|
$tabellen[] = "unileipzig-de";
|
||||||
echo "<p><strong>Das Wort ist richtig</strong></p>";
|
}
|
||||||
exit;
|
if(isset($_GET["ul-en"])) {
|
||||||
|
$tabellen[] = "unileipzig-en";
|
||||||
|
}
|
||||||
|
if(isset($_GET["nm"])) {
|
||||||
|
$tabellen[] = "netzmafia";
|
||||||
|
}
|
||||||
|
require_once 'verbindungsaufbau.php';
|
||||||
|
foreach ($tabellen as $tabelle) {
|
||||||
|
$vorhanden = $mysqli->query("SELECT id FROM `$tabelle` WHERE wort='$falscheswort'");
|
||||||
|
if($vorhanden->num_rows == 1) {
|
||||||
|
echo "<p><strong>Das Wort ist richtig</strong></p>";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$vorhanden->close();
|
||||||
}
|
}
|
||||||
$ergebnis = $mysqli->query("SELECT wort FROM `unileipzig-en`,`unileipzig-de`");
|
|
||||||
// echo "<table border='1'>\n";
|
|
||||||
$arrayahnlich =array(); // leeres Array erstellen
|
$arrayahnlich =array(); // leeres Array erstellen
|
||||||
while ($wort = $ergebnis->fetch_array()) {
|
|
||||||
$ahnlichkeit=levenshtein($falscheswort, $wort[0]);
|
foreach ($tabellen as $tabelle) {
|
||||||
// echo "<tr><td>$wort[0]</td><td>$ahnlichkeit</td></tr>";
|
$ergebnis = $mysqli->query("SELECT wort FROM `$tabelle`");
|
||||||
$arrayahnlich[$wort[0]] = $ahnlichkeit;
|
// echo "<table border='1'>\n";
|
||||||
|
while ($wort = $ergebnis->fetch_array()) {
|
||||||
|
$ahnlichkeit=similar_text($falscheswort, $wort[0]);
|
||||||
|
// echo "<tr><td>$wort[0]</td><td>$ahnlichkeit</td></tr>";
|
||||||
|
$arrayahnlich[$wort[0]] = $ahnlichkeit;
|
||||||
|
}
|
||||||
|
$ergebnis->close();
|
||||||
|
// echo "</table>";
|
||||||
}
|
}
|
||||||
asort($arrayahnlich);
|
asort($arrayahnlich);
|
||||||
$top = array_keys($arrayahnlich);
|
$top = array_keys($arrayahnlich);
|
||||||
echo "$top[0],$top[1],$top[2],$top[3]";
|
echo "$top[0],$top[1],$top[2],$top[3]";
|
||||||
|
print_r($top);
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
|
|
Reference in a new issue