> -----Original Message-----
> From: Chris White [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 09, 2006 11:43 AM
> To: mysql@lists.mysql.com
> Subject: Re: how to store quotes in mysql?
> 
> On Wednesday 09 August 2006 08:37 am, Kristen G. Thorson wrote:
> >
> > [ stuff here ]
> >
> > kgt
> I'm confused.. did you read my email?  Most of what you said doesn't
seem
> to
> correlate with what I said.  Can you quote the specific lines that
you're
> disagreeing with?
> --
> Chris White
> PHP Programmer/DBacillus
> Interfuel





Sure:

"Yes, MySQL stores it that way for a specific reason."

MySQL does not STORE escape characters, unless you have escaped an
escape character.  The following query:

INSERT INTO myTABLE VALUES ('I\'m Happy');

is instructing MySQL to store the string value "I'm Happy."  It does not
store "I\'m Happy."

"Now when displaying, you'll have to unescape the slashes generally."

A clear indication that you have over-escaped your data.  If you have
properly escaped your queries, then you should never need to unescape
them.

If

SELECT string_value FROM myTable;

returns

I\'m Happy

then you have inserted your data as follows:

INSERT INTO myTable VALUES( 'I\\\'m Happy' );

This happens because magic quotes produced escaped data:

I\'m Happy

You then run addslashes() or similar and end up with this:

I\\\' Happy



kgt


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to