I am trying to make a function to show 5 related keywords for whatever search query is done. For example if someone searched for blueberry it would show 5 similar keywords such as blueberry jam, blue blueberry, blueberrys “I know that spelled incorrectly but I am just getting the point accross. So far I have came up with this but it only repeats the query keyword 5 times and I cannot figure out how to make it show the similar keywords and I also dont know if this is the best way to do this? Can anyone give me some input? thanks.
$result=mysql_query(“select keyword from keywords WHERE keyword like ‘%{$query}%’ LIMIT 5”);
while ($row=mysql_fetch_row($result))
echo “”.($query).””
The table I am using is called keywords and the columns I need are keyword.
1 Answer