RE: [PHP] Strange emergence of \
| From: | Matt Williams | Date: | Wed, 01 Nov 2000 17:32:58 +0000 |
| Subject: | RE: [PHP] Strange emergence of \ | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-23192@lists.php.net to get a copy of this message | ||
>
> I have a simple form that collects some data, one field being a textarea.
> The file sends the info to itself for errorchecking, then makes a call to
> a MySQL database and enters the info. Along the way however, whenever i
> put a ' in the textarea field, for example: Microsoft's engineers are
> weenies, in the end, Microsoft\'s engineers are weenies gets input into
> the database. Is this something to do with textarea? I don't do anything
> strange to the string....ne help appreciated...
> Jack Dempsey
Hi Jack
see here
www.php.net/addslashes
and
www.php.net/stripslashes
because mysql uses ' as part of it's queries, you need to escape them when
entering them into the db so it won't get confused.
The reason why it's adding the slashes on it's own is something to do with
one of the settings in your php.ini, I can't remember which one, but I'm
sure someone will fill in the blanks :-)
M@