PHPNewbie55 Posted January 6, 2008 Share Posted January 6, 2008 I am trying to import CSV data into a MySQL database. The only problem I have is that some of the data contains characters that give MySQL Errors, such as %#^*_(/)';-" etc.... What would be the best way to strip all of that out without using a str_replace("", "", data[2])? I do not want to str_replace anything.. because it would be impossible for me to add a str_replace for every character (because I don't know what they are going to be)... So what would you suggest..?? htmlentities() htmlspecialchars() addslashes() Or something else...?? Quote Link to comment https://forums.phpfreaks.com/topic/84774-solved-replacing-_-etc/ Share on other sites More sharing options...
cooldude832 Posted January 6, 2008 Share Posted January 6, 2008 mysql_real_escape_string Quote Link to comment https://forums.phpfreaks.com/topic/84774-solved-replacing-_-etc/#findComment-432018 Share on other sites More sharing options...
PHPNewbie55 Posted January 6, 2008 Author Share Posted January 6, 2008 Hey that works way better... still have to replace a few characters but at least I can tell what to replace now... THANK YOU!!!!!! Quote Link to comment https://forums.phpfreaks.com/topic/84774-solved-replacing-_-etc/#findComment-432027 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.