PDA

View Full Version : PHP / MySQL escapes data in TEXT field - why?


swissmant
12-2-06, 01:39 AM
I have a MySQL database on here with PHP.

I have various types of field. I am not escaping data (knowingly) in my PHP script, however, TEXT fields seem to escape automatically and then my data is escaped throughout i.e. 'a%20word%20here', but only TEXT fields. How can I stop this happening, or at the least decode it (unescape it) when it comes back?

Thanks.

mixerson
12-2-06, 01:30 PM
Strings that use '%' as an escape character are decoded with the PHP function rawurldecode().

By any chance, does your script call rawurlencode() before inserting into your database?

If not, post the code that does the insertion and we'll take a look.

Also, is the data posted from a form?
GET or POST method?

swissmant
12-3-06, 08:00 PM
Hi Mixerson. Thanks for the reply.

I have resolved the problem and feel pretty stupid about what I did. I called a javascript function and actually escaped the data in there whereas I was looking through my php and mysql thinking there was something up with that instead.

Thank you for taking the time to reply.

Anthony
:eek:

mixerson
12-3-06, 08:20 PM
Glad you figured it out :dd !