LoneStarJack Posted November 30, 2011 Share Posted November 30, 2011 I enter the following: select nam_last from names where nam_last = 'cohn' into a form field When I print it in the next program I get select nam_last from names where nam_last = \'cohn\' Which generates an error: SELECT Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '\'cohn\'' at line 1 What causes the \ to be added into the field, and how do I stop it? Quote Link to comment https://forums.phpfreaks.com/topic/252149-escape-character-being-added-to-post-data/ Share on other sites More sharing options...
requinix Posted November 30, 2011 Share Posted November 30, 2011 Check if you have magic_quotes enabled in your php.ini. If it is then disable it and restart the web server. Why are you entering SQL into a form? And then trying to execute it? Quote Link to comment https://forums.phpfreaks.com/topic/252149-escape-character-being-added-to-post-data/#findComment-1292748 Share on other sites More sharing options...
LoneStarJack Posted November 30, 2011 Author Share Posted November 30, 2011 Thank you. My host must have updated my phpinfo. I had to have him turn off magic quotes because I could not find out where it is controled. I have it off on my local site and would never put it on. Quote Link to comment https://forums.phpfreaks.com/topic/252149-escape-character-being-added-to-post-data/#findComment-1292783 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.