Re: stripping slashes before insert behaving badly
| From: | Foong | Date: | Tue, 18 Mar 2003 01:49:40 +0000 |
| Subject: | Re: stripping slashes before insert behaving badly | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-140068@lists.php.net to get a copy of this message | ||
if Magic_quotes_gpc in you php.ini is set to 'on', php will automatically
escape(add slashes) for you.
Foong
"Charles Kline" <ckline@rightcode.net> wrote in message
news:313BB589-589D-11D7-9D42-000393CDCA6A@rightcode.net...
> John,
>
> You are right, something was adding the additional slash. I removed the
> addslashes() and it fixed the problem. Something I am doing must
> already be handling that... will step through the code AGAIN and see if
> I can find it.
>
> - Charles
>
> On Monday, March 17, 2003, at 12:19 PM, John W. Holmes wrote:
>
> >> I am inserting data from a form into a mySQL database. I am using
> >> addslashes to escape things like ' in the data input (this is actually
> >> being done in PEAR (HTML_QuickForm).
> >>
> >> The weird thing is that the data gets written into the table like:
> >> what\'s your problem?
> >>
> >> WITH the slash. I am not sure what to modify to fix this so the
> > literal
> >> slash is not written.
> >
> > You're running addslashes() twice, somehow. Magic_quotes_gpc is
> > probably
> > on and you're escaping the data again. I would think PEAR would account
> > for that, but I guess not.
> >
> > ---John W. Holmes...
> >
> > PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> > today. http://www.phparch.com/
> >
> >
>