jeff5656 Posted January 10, 2012 Share Posted January 10, 2012 If I put into the database this string: Call the wife's son tomorrow How do I put it in to keep that apostrohe (wife's) and then when I retrieve it, also keep it without it displaying as wife/'s If I use stripslashes I think that just gets rid of the slash, but I want to KEEP the slash (but still protecting the database so it is not seen as a quote by the php code). I hope this is clear :-) Quote Link to comment https://forums.phpfreaks.com/topic/254730-maintaining-quotes/ Share on other sites More sharing options...
ManiacDan Posted January 10, 2012 Share Posted January 10, 2012 Don't use stripslashes or addslashes, and make sure magic_quotes is OFF. use mysql_real_escape_string on your INSERT statements only. Don't do anything when you retrieve the data. Quote Link to comment https://forums.phpfreaks.com/topic/254730-maintaining-quotes/#findComment-1306147 Share on other sites More sharing options...
jeff5656 Posted January 10, 2012 Author Share Posted January 10, 2012 use mysql_real_escape_string on your INSERT statements only. Don't do anything when you retrieve the data. I do use mysql_real_escape_string but when I retrieve it and display it it displays as wife/'s instead of wife's Quote Link to comment https://forums.phpfreaks.com/topic/254730-maintaining-quotes/#findComment-1306150 Share on other sites More sharing options...
ManiacDan Posted January 10, 2012 Share Posted January 10, 2012 Then you have magic quotes turned on, check your php.ini Your slash has been backward in both of your examples so far. Is it really /' or is is \' ? Quote Link to comment https://forums.phpfreaks.com/topic/254730-maintaining-quotes/#findComment-1306163 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.