Jump to content

[SOLVED] magic_quotes_gpc help


pocobueno1388

Recommended Posts

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 :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.