mjurmann Posted March 16, 2008 Share Posted March 16, 2008 Hello. Why are my single and double quotes appearing with a "\" before them? I'd like it to just echo out as "This guy's goose is cooked." Instead, it echoes as "This guy\'s goose is cooked." Is there any way to filter the string to fix this before it is echoed? Not just single quotes, but double quotes too. Thanks! Link to comment https://forums.phpfreaks.com/topic/96429-why-are-my-single-and-double-quotes-appearing-with-a-before-them/ Share on other sites More sharing options...
sasa Posted March 16, 2008 Share Posted March 16, 2008 stripslashes() Link to comment https://forums.phpfreaks.com/topic/96429-why-are-my-single-and-double-quotes-appearing-with-a-before-them/#findComment-493537 Share on other sites More sharing options...
BlueSkyIS Posted March 16, 2008 Share Posted March 16, 2008 yes, magic quotes is turned on. you'll need to use stripslashes() to output slashed data without slashes. the reason for magic_quotes is to make it simpler to use user input in SQL queries, where single and double-quotes are special characters. Link to comment https://forums.phpfreaks.com/topic/96429-why-are-my-single-and-double-quotes-appearing-with-a-before-them/#findComment-493545 Share on other sites More sharing options...
mjurmann Posted March 16, 2008 Author Share Posted March 16, 2008 Thanks guys, greatly appreciate the help. Link to comment https://forums.phpfreaks.com/topic/96429-why-are-my-single-and-double-quotes-appearing-with-a-before-them/#findComment-493547 Share on other sites More sharing options...
PFMaBiSmAd Posted March 16, 2008 Share Posted March 16, 2008 Magic quotes have been eliminated in php6 because of all the problems and wasted time working around them. If you can, you should simply turn all the magic quote settings off in the master php.ini, a .htaccess file, or a local php.ini Link to comment https://forums.phpfreaks.com/topic/96429-why-are-my-single-and-double-quotes-appearing-with-a-before-them/#findComment-493552 Share on other sites More sharing options...
BlueSkyIS Posted March 16, 2008 Share Posted March 16, 2008 good advice. i've grown used to them and should learn to do without. i should take your advice and turn off magic quotes too. Link to comment https://forums.phpfreaks.com/topic/96429-why-are-my-single-and-double-quotes-appearing-with-a-before-them/#findComment-493556 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.