Re: [PHP4BETA] Addslashes
| From: | Teodor Cimpoesu | Date: | Wed, 15 Dec 1999 16:16:05 +0000 |
| Subject: | Re: [PHP4BETA] Addslashes | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-7958@lists.php.net to get a copy of this message | ||
root wrote:
>
> Guys, i think i hit a bug in the php-4b3 release. Ive got a script that
> saves a text field from a entry form (<textarea>) into a DB field (mysql
> mediumtext). On submission i do a
> $text = addslashes($text);
> to prevent SQL errors. When i save this 'string', and edit the content
> again it has still got \'s in the text. Eg
> begin text : i'm curious how this will work
> text after addslashes (so send to the DB) : i\\\'m curious
> text when querying/displaying string: i\'m curious
>
> So it seems the addslashes function is a little escape happy in php-4b3.
> Ps this behaviour isnt present in the php-3 series, and is new under
> php-4b's ...
I'm using a simple rule:
IIRC if you have magic_quotes_runtime you don't have to escape the
queries
else escape the queries.
When you retrieve the data from a DB you don't have to touch in any way
any slash.
It's just okay.
--
CIMPOESU Teodor, Web Programmer
@ DIGICOM S.A. Bucharest, Romania
@ Internet, site development
@ teo@digiro.net , +(401)-330.47.28
official home page ~ http://www.digiro.net/
Internet web page ~ http://internet.digiro.net/