pocobueno1388 Posted September 13, 2007 Share Posted September 13, 2007 This is very pathetic, but I can't seem to figure it out. Right now I am having to use stripslashes() on EVERY row I want to display from the database, and I really don't want to have to do this anymore. I want to figure out how to make it so the database automatically strips the slashes for you when displaying rows. I just tried this: ini_set('magic_quotes_gpc', 'off'); ini_set('magic_quotes_runtime', 'off'); It didn't do anything though...the slashes are still there. I'm really not sure what else to do. Thanks for any help on my pathetic question Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 13, 2007 Share Posted September 13, 2007 try 0 instead of off? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted September 13, 2007 Author Share Posted September 13, 2007 Nope, didn't work =/ Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 13, 2007 Share Posted September 13, 2007 Are you sure those slashes aren't IN the database entries? I had that problem once. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted September 13, 2007 Author Share Posted September 13, 2007 Yes, they are in the database entries. I use mysql_real_escape_string() on all the variables before I insert them. I thought there was a way to automatically strip them when coming out of the DB though? I don't remember having this problem on a past website, but I'm pretty sure it was done for me. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 13, 2007 Share Posted September 13, 2007 Okay, here is how it works If magic quotes gpc was on when you did mysql_real_escape_string it will have added extra slashes. So instead of "My name is O'Malley" being stored, it stored "My name is O\'Malley" which is not what you want. So on the entries that have extra slashes the only way to remove them is to edit the entries or use strip_slashes Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted September 13, 2007 Author Share Posted September 13, 2007 Yeah, I figured that could be what was happening, but I made completely new entires after I did the ini_set, and it is still adding the slashes to the DB. Maybe my attempt to turn magic_quotes_gpc off isn't working? Wait, can I check this using phpinfo()? Let me check that. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 13, 2007 Share Posted September 13, 2007 ini_set returns the old value if it was changed, or false if not. Try printing the results of ini_set. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted September 13, 2007 Share Posted September 13, 2007 Isn't 6 destroying magic quotes? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted September 13, 2007 Author Share Posted September 13, 2007 Isn't 6 destroying magic quotes? I'm not sure what you mean by that... Well, phpinfo says that magic_quotes is still on, but magic_quotes_runtime is off. I'm not sure why the magic_quotes won't budge >.< How exactly do I print out the results of the ini_set? Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 13, 2007 Share Posted September 13, 2007 print ini_set('blah', 0); Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted September 13, 2007 Author Share Posted September 13, 2007 It prints nothing...hmmm. I'm gonna have to leave this thread dormant for a while, I have to go to work. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 13, 2007 Share Posted September 13, 2007 Then it was false, meaning it didn't set it. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted September 13, 2007 Author Share Posted September 13, 2007 How could it not set? Is it possible for my server to block being able to change it? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted September 13, 2007 Author Share Posted September 13, 2007 Okay, I figured out that I had to make a custom php.ini file...I did that and they turned off, but then my script wasn't adding to the database for some reason, and I wasn't getting any errors. So I decided to take it up with my host. They said they don't know whats going on and they are working on fixing it for me. Thanks for the help jesirose. I feel better that it was my hosts fault, I was feeling really stupid for a second. Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 14, 2007 Share Posted September 14, 2007 cool, hope it works out Quote Link to comment 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.