Jacky Posted May 28, 2007 Share Posted May 28, 2007 Hi, I have a small script giving me some headaches and hope somebody can help a girl out. The two lines below is the test text I use. Sandy said, "It's a beautiful day outside and I like to use \'s." C:\Windows\system.txt And this is what I get from the DB after running stripslashes: Sandy said, "It's a beautiful day outside and I like to use 's." C:Windowssystem.txt I insert the data from a form which is submitted via POST. I retrieve the $_POST value and addslashes. Here is the MySQL string retrieved via die($sql); update ticket set Service_Performed="Sandy said, \"It\'s a beautiful day outside and I like to use \\\'s.\" C:\\Windows\\system.txt Last Saved by admin on May-28-2007, 6:00 pm",Tech_Notes="",Status_id="2" where ID="24" As you can see it contains the proper slashes. Doing it the same way, here is the string retrieved from the database right after the select query before running stripslashes: Sandy said, "It's a beautiful day outside and I like to use \'s." C:\Windows\system.txt Why is this? I have not executed strip slashes but the slashes have been stripped already. I connected to Mysql via command line and noticed that a table query did not show the additional slashes either. Does anybody know what is causing this automatic stripslash behavior? PHP: 5.2.0 MySQL: 5.0.26 Thank you for reading.... Quote Link to comment https://forums.phpfreaks.com/topic/53325-solved-problems-with-stripslashes/ Share on other sites More sharing options...
Jacky Posted May 28, 2007 Author Share Posted May 28, 2007 Grrrr. it was the function to handle those nasty magic quotes I added last week. I'm glad magic pain is going to be removed in PHP6 EDIT: Nope not solved, brain fart. still the same problem and it's not caused by my magic quotes sniper (currently disabled). Quote Link to comment https://forums.phpfreaks.com/topic/53325-solved-problems-with-stripslashes/#findComment-263553 Share on other sites More sharing options...
Jacky Posted May 29, 2007 Author Share Posted May 29, 2007 OK, if all else fails, read the manual. The addslashes is only needed during insert so that the query string is not broken. But once it's in the database stripslashes is not needed. Quote Link to comment https://forums.phpfreaks.com/topic/53325-solved-problems-with-stripslashes/#findComment-263614 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.