xshanelarsonx Posted February 13, 2007 Share Posted February 13, 2007 I want to make this. "Song's Rock" Into this. "Songs Rock" Can you please help fix this code to do that? $songname2 = str_replace("'", "", $songname); Quote Link to comment https://forums.phpfreaks.com/topic/38255-solved-replace-problem/ Share on other sites More sharing options...
Jessica Posted February 13, 2007 Share Posted February 13, 2007 What's wrong with it? Quote Link to comment https://forums.phpfreaks.com/topic/38255-solved-replace-problem/#findComment-183263 Share on other sites More sharing options...
xshanelarsonx Posted February 13, 2007 Author Share Posted February 13, 2007 I get this error because it replaces "'" with "\". "Warning: move_uploaded_file(Files/Music/afgd\s.mp3) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\AppServ\www\Music_Upload.php on line 45" Quote Link to comment https://forums.phpfreaks.com/topic/38255-solved-replace-problem/#findComment-183274 Share on other sites More sharing options...
Jessica Posted February 13, 2007 Share Posted February 13, 2007 run stripslashes() on it. It's not replacing ' with \, it's putting \ in front of ', (magic quotes) then you're stripping the 's. Quote Link to comment https://forums.phpfreaks.com/topic/38255-solved-replace-problem/#findComment-183278 Share on other sites More sharing options...
13th_Star Posted February 13, 2007 Share Posted February 13, 2007 try this then: $songname2 = str_replace("'", "", $songname); $songname2 = str_replace("\\", "", $songname2); Quote Link to comment https://forums.phpfreaks.com/topic/38255-solved-replace-problem/#findComment-183279 Share on other sites More sharing options...
xshanelarsonx Posted February 13, 2007 Author Share Posted February 13, 2007 Thanks Jesirose, that fixed it. Sorry for the long reply I was testing other stuff after that. Quote Link to comment https://forums.phpfreaks.com/topic/38255-solved-replace-problem/#findComment-183289 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.