dt192 Posted February 9, 2009 Share Posted February 9, 2009 Hi, I am using the following function: function clean_text($text, $filter) { if(get_magic_quotes_gpc()){$text = stripslashes($text);} if($filter=='unclean'){return htmlspecialchars(stripslashes($text), ENT_NOQUOTES);} else if($filter=='N'){return mysql_real_escape_string(preg_replace('/[^0-9]/', '', $text));} else if($filter=='AN'){return mysql_real_escape_string(preg_replace('/[^a-zA-Z0-9]/', '', $text));} else{return mysql_real_escape_string($text);} } if i use it with the following code: $string="¬!\"£$%^&*()_+{}:@~<>?`-=[];'#,./<br/>"; echo $string.'<br/>'; echo clean_text($string,'').'<br/>'; echo clean_text($string,'unclean').'<br/>'; I get: ¬!"£$%^&*()_+{}:@~<>?`-=[];'#,./<br/> ¬!\"£$%^&*()_+{}:@~<>?`-=[];\'#,./<br/> ¬!"£$%^&*()_+{}:@~<>?`-=[];'#,./<br/> which is exactly what i want but when i use the same code on my hosted web site and insert it into the MYSQL database i get: ¬!"£$%^ any idea what's going wrong? Link to comment https://forums.phpfreaks.com/topic/144436-odd-php-mysql-prob/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.