Organizational Research By

Surprising Reserch Topic

levenshtein mysql php


levenshtein mysql php  using -'php,mysql,levenshtein-distance'

$word = strtolower($_GET['term']);

$lev = 0;

$q = mysql_query("SELECT `term` FROM `words`");
while($r = mysql_fetch_assoc($q))
{
    $r['term'] = strtolower($r['term']);

    $lev = levenshtein($word, $r['term']);

    if($lev >= 0 && $lev < 5)
    {
        $word = $r['term'];
    }
}


How can I move all that into just one query? Don't want to have to query through all terms and do the filtering in PHP.
    

asked Sep 10, 2015 by ENYJay
0 votes
14 views



Related Hot Questions

8 Answers

0 votes
NULL
answered Sep 10, 2015 by IsiI74
0 votes
NULL
answered Sep 10, 2015 by KaceySpyerm
0 votes
NULL
answered Sep 10, 2015 by KejDoolan
0 votes
NULL
answered Sep 10, 2015 by DarScarboro
0 votes
NULL
answered Sep 10, 2015 by Epifania8324
0 votes
NULL
answered Sep 10, 2015 by MariettaBurg
0 votes
NULL
answered Sep 10, 2015 by SilLively
0 votes
NULL
answered Sep 10, 2015 by KarlJllxyomh

...