tags:

views:

56

answers:

3

I have a text-area where text and an image url is entered.

Text is formatted like this:

         my best friend's email is ............
         etc
         http://www.google.com/intl/en_ALL/images/logo.gif

After the form is submitted, I use mysql_escape_string() to store the value in my database

My problem is image the url has changed.

How can I store this type of data in mysql using php with the correct (original, unaltered) image url?

-Thanks

A: 

It is possible you are double escaping the string.

Eg PHP with magic quotes on will escape the values in POST and GET before your script begins executing and if you then call mysql_escape_string as well..., well, it would be a mess.

rikh
+1  A: 

Use mysql_real_escape_string instead, that one you're using is deprecated and its use is discouraged.

yoda
A: 

I would advise splitting your textarea into a textarea and a text input field for the image url. Different containers for different things.

You can debug this problem by echo'ing the pre-escaped, post-escaped strings and the SQL query that put's it in the database.

Niels Bom