function find_words() { $a = mysql_query("SELECT word from dictionary")or die(mysql_error()); $results=array(); while($row=mysql_fetch_array($a)) { $results[]=$row; } $replacewith = "$results"; $content = "Niche and There is"; //the_content(); $newData = str_replace($words, $replacewith, $content); echo $newData; }