Hi, I need a Filtering words before inserting into db $select=mysql_query("SELECT * FROM sh WHERE tags='$displaysearch' LIMIT 1") or die(mysql_error()); if( mysql_num_rows($select) ){ mysql_query("UPDATE sh SET count=count+1 WHERE tags='$displaysearch'") or die(mysql_error()); }else{ mysql_query("INSERT INTO sh SET tags='$displaysearch'") or die(mysql_error()); } Code (markup): Using something like this: When I write the word "sex" is replaced by "," $placeholders = array('http', '//', ':', 'sex'); $replacement = array('', '', '', ''); Code (markup): The problem is I don´t know how to resolve this. Could you can help me? Thank you very much.
$placeholders = array('http', '//', ':', 'sex'); $replacement = ''; // you don't have to pass an array with empty strings $censored = str_replace($placeholders, $replacement, $displaysearch); PHP: The code above will replace all strings from $placeholders with $replacement value(empy string in this case).