Devine Posted August 2, 2007 Share Posted August 2, 2007 How can I remove all the: ' from a variable? Quote Link to comment https://forums.phpfreaks.com/topic/63094-solved-remove-from-variable/ Share on other sites More sharing options...
lightningstrike Posted August 2, 2007 Share Posted August 2, 2007 $string = str_replace("'","",$string); or you could escape it with addslashes($string); or mysql_real_escape_string($string); Quote Link to comment https://forums.phpfreaks.com/topic/63094-solved-remove-from-variable/#findComment-314237 Share on other sites More sharing options...
Devine Posted August 2, 2007 Author Share Posted August 2, 2007 what about replacing \\ to \ Quote Link to comment https://forums.phpfreaks.com/topic/63094-solved-remove-from-variable/#findComment-314243 Share on other sites More sharing options...
Salis Posted August 2, 2007 Share Posted August 2, 2007 I'd use stripslashes() to go from \\ to \ Quote Link to comment https://forums.phpfreaks.com/topic/63094-solved-remove-from-variable/#findComment-314248 Share on other sites More sharing options...
Devine Posted August 2, 2007 Author Share Posted August 2, 2007 yea I just realized that, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/63094-solved-remove-from-variable/#findComment-314251 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.