Re: [PHP4BETA] Addslashes

From: Date: Wed, 15 Dec 1999 14:41:28 +0000
Subject: Re: [PHP4BETA] Addslashes
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-7948@lists.php.net to get a copy of this message
Chris- I ran into the same problem, but after more testing (and lots of hair pulling), I finally realized that the information coming back from the form was already escaped, so doing it again (with addslashes) is what over escaped the data. Hope this helps, -Ben Schumacher At 11:05 AM 12/15/99 +0100, you 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 ...


« previous php.version4 (#7948) next »