Re: help on getting rid of \'
| From: | Rasmus Lerdorf | Date: | Wed, 18 Jul 2001 08:49:33 +0000 |
| Subject: | Re: help on getting rid of \' | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-58418@lists.php.net to get a copy of this message | ||
> I am working with php and mysql and have the need to write a query like:
>
> $sql_statement=mysql_query(" select * from table where column='string' ");
>
> What comes out is:
>
> select * from table where column=\'string\'
Only if you pass that variable through a GET/POST/COOKIE operation and you
have magic_quotes_gpc enabled in your php.ini file. Either turn
magic_quotes off or call stripslashes() on your string before passing it
to MySQL.
But, are you sure you want to be passing entire query strings between
pages? Normally you would only pass the actual query arguments. In your
case probably the 'string' part.
-Rasmus