Search the Community
Showing results for tags 'syntex'.
-
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; } 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 ?
-
function send_msg($sender , $message){ if(!empty($sender) && !empty($message)){ $sender = mysql_real_escape_string($sender); $message= mysql_real_escape_string($message); $query = "INSERT INTO `chat`.`chat` VALUES (null , '{$sender}' , '$message')"; // Difficulty on THIS LINE !!!! if($run = mysql_query($query)){ return true; }else{ return false; } } why is '{$sender}' given the curley brakets ????? and why is message not given the same brackets ? also why is this function used ? i.e. mysql_real_escape_string , i know what it does , but is it to prevent SQL injection.