You are here: Re: Mysterious \' « PHP Programming Language « IT news, forums, messages
Re: Mysterious \'

Posted by Paul Haxter on 02/05/06 05:56

What you are describing is an issue that all php newbies face.

It is caused by a setting in the PHP configuration file called
magic_quotes_gpc. If this is turned on (which it is by default), all '
(single-quotes), " (double quotes), and \ (backslashs) are escaped with
a backslash automatically in the GET, POST, and COOKIE globals.

Many databases (MySQL for example) and other systems need escape
characters to handle such characters. PHP automatically adds these
slashes so you don't have to when you want to use the data in other
systems. Isn't that nice of PHP? Many people, including myself, say
NO! But it does.

You have two options:

1. Change the PHP configuration of magic_quotes_gpc to off.

2. Use the stripslashes() function to remove the escape slashes from
the posted variables. I strongly suggest that you use this method
because if you simply change the configuration, your script would not
work right on other systems not properly configured.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация