Jump to content

syntax error, unexpected ':'


Recommended Posts

Hi I'm currently having a syntex error with my bad words filter function

function filterBadWords($str)
    $result1 = mysql_query("SELECT word FROM StringyChat_WordBan") or die(mysql_error()); 
    $replacements = "x";
    while($row = mysql_fetch_assoc($result1))
          $str = preg_replace('/\b' . $row['word'].'\b/ie', ':-x', $str);
    return $str;


Parse error: syntax error, unexpected ':' in /home/u342037492/public_html/chat2/page.php(1917) : regexp code on line 1

Fatal error: preg_replace(): Failed evaluating code: :-x in /home/u342037492/public_html/chat2/page.php on line 1917

I know its the :-x part causing the problem but how can I fix it?


and is there maybe a better way to do the filter because if I got the word "ass" in my list it will replace assassinate to  :-x :-xinate ?

Link to comment
Share on other sites


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.