Beauford Posted March 30, 2010 Share Posted March 30, 2010 I have spent many an hour trying to understand this apostophe problem and escape strings, etc. etc. and thought I had it figured out - well, I guess I didn't. I changed hosting servers yesterday, and copied everything to the new server - no code was changed but now I have the same problem as I did before. Whenever someone places an apostrophe in an form input, the output shows a \ before the apostrophe. So what could possibly be different in PHP or MySQL that I can change so it works like it did on the old server. I know this is a broad question but I just don't get what could be different. I don't understand this escape crap, htmlentities, and addslashes, and whatever else to start with and spent litterly hours on end getting it to work, just to have it fall apart on another server. Any help is appreciated, I have to cut this short as this forum is acting up as well and is bouncing all over the place. Quote Link to comment https://forums.phpfreaks.com/topic/196940-apostrophes-again/ Share on other sites More sharing options...
Beauford Posted March 30, 2010 Author Share Posted March 30, 2010 Weird forum. This happened before too when I tried typing a lot of text in a post. The text just bounces all over an you can't see what you are typing. Anyway, any help at all on the original problem is appreciated as it is more than annoying. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/196940-apostrophes-again/#findComment-1033912 Share on other sites More sharing options...
PFMaBiSmAd Posted March 30, 2010 Share Posted March 30, 2010 [sarcasm]Oh no, not more time wasted by a php feature that was supposed to be a lazy what short cut to "help a few beginners blissfully and unknowingly write better (more secure) code."[/sarcasm] What is your current form processing code and the code that is retrieving the data from the database? What does a phpinfo() statement show for the magic_quotes_gpc and magic_quotes_runtime settings? Quote Link to comment https://forums.phpfreaks.com/topic/196940-apostrophes-again/#findComment-1033913 Share on other sites More sharing options...
Beauford Posted March 30, 2010 Author Share Posted March 30, 2010 magic_quotes_gpc On On magic_quotes_runtime Off Off magic_quotes_sybase Off Off Quote Link to comment https://forums.phpfreaks.com/topic/196940-apostrophes-again/#findComment-1033916 Share on other sites More sharing options...
Beauford Posted March 30, 2010 Author Share Posted March 30, 2010 Not 100% sure what you are asking here. "What is your current form processing code and the code that is retrieving the data from the database?" But when code is imput I use mysql_real_escape_string($var). When I view it I use something like this - stripslashes(htmlentities($var],ENT_QUOTES)) Thanks Quote Link to comment https://forums.phpfreaks.com/topic/196940-apostrophes-again/#findComment-1033923 Share on other sites More sharing options...
Beauford Posted March 30, 2010 Author Share Posted March 30, 2010 Anyone?? Quote Link to comment https://forums.phpfreaks.com/topic/196940-apostrophes-again/#findComment-1034310 Share on other sites More sharing options...
Beauford Posted April 1, 2010 Author Share Posted April 1, 2010 Really........ LOL Quote Link to comment https://forums.phpfreaks.com/topic/196940-apostrophes-again/#findComment-1035057 Share on other sites More sharing options...
oni-kun Posted April 1, 2010 Share Posted April 1, 2010 What you should really do is incorporate this logic if you do not understand: $string = "I'm full of nonsense and things!" if(get_magic_quotes_gpc()): stripslashes($string); } $string = mysql_real_escape_string($string); //Continue to send to DB Quote Link to comment https://forums.phpfreaks.com/topic/196940-apostrophes-again/#findComment-1035059 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.