Jump to content

Word filter problem


hadeosdin

Recommended Posts

Hello,

 

im trying to make a filter for words inputted in to my website but i want to store the swear word and the replacement for that word in a mysql db i have developed the code below;

 

<?php

 

include("config.php");

 

 

$str = 'how are you have you got any money';

 

 

 

 

$result = mysql_query("SELECT * FROM table")

or die(mysql_error()); 

 

while($row = mysql_fetch_array( $result )) {

$words = array($row['word'],);

$filter = array($row['translated_word'],);

 

 

}

echo str_replace($words, $filter, $str);

?>

 

but it just dose not return the filters how i need it to it will only list it as it returns them like

 

wordwordwordwordword

 

but i need it to return them like

 

word,word,word,word,word

 

how would i do this? please help me =] thanks

Link to comment
https://forums.phpfreaks.com/topic/178532-word-filter-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.