I have programmed this function
function bad_words($val){
global $pre;
$sql = mysql_query("SELECT * FROM " . $pre . "BAD_WORDS") or die(mysql_error());
$rs = mysql_fetch_assoc($sql);
if (mysql_num_rows($sql) > 0) {
$bad_words = $rs['BAD_WORD'];
$replace = $rs['REPLACE'];
}
$val = str_ireplace($bad_words, $replace, $val);
return $val;
}
BAD_WORDS Table (ID, BAD_WORD, REPLACE)
When I use this function it replaces word with id = 1 but doesn't replace the other words.
What am I missing?