[thelist] Double quotes ("), PHP & MySQL

Jay Blanchard jay.blanchard at niicommunications.com
Wed Aug 21 08:34:01 CDT 2002


[snip]
How can I get this to work ?
Replace the double quotes with single quotes in onSubmit when the value is
first inserted ?
Any other solutions ?
[/snip]

Look at the PHP functions addslashes() and stripslashes(). addslashes will
escape both single and double quotes so that those characters get put into
the database correctly. When you retrieve that data from the database, do so
with stripslashes() so that it looks proper. You have a directive in your
php.ini called magic quotes, which usually takes care of this. I recommend
turning it off and handling all data transfers as above.

HTH!

Jay

***********************************************************
* Texas PHP Developers Conf  Spring 2003                  *
* T Bar M Resort & Conference Center                      *
* New Braunfels, Texas                                    *
* San Antonio Area PHP Developers Group                   *
* Interested? Contact jay.blanchard at niicommunications.com *
***********************************************************





More information about the thelist mailing list