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); 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? 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" 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. 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); 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. Link to comment https://forums.phpfreaks.com/topic/38255-solved-replace-problem/#findComment-183289 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.