I assume that you are using htmlspecialchars() or htmlentities() to
encode characters that have special meanings under HTML. Don't - your
data will be inserted into the database verbatim.
You may have to use addslashes() on your data to escape the quotes
before you insert it into the database - you'll get an SQL error if so.
Just do this:
<?php
//$str is your data being inserted
$str = addslashes($str);
//now do db insert
?>
If you just want to translate what you've got into working HTML, use
this bit of code:
<?php
//$str should contain the string you want translated
//if you are using htmlspecialchars(), change HTML_ENTITIES to
HTML_SPECIALCHARS
$trans = get_html_translation_table (HTML_ENTITIES);
$trans = array_flip ($trans);
$original = strtr ($str, $trans);
?>
Ben Gollmer
Jatosoft, LLC
On Wednesday, June 6, 2001, at 01:20 AM, Michele Santucci wrote:
> I have a stupid problem with PHP & MySQL (I'm a newbie of course):
>
> I push in a text/blob record a string like this:
>
> <img src="foo.gif" border="0">
>
> when I read & print this record with PHP (using a simple echo
> statement ) I got back the string translated in this way:
>
> <IMG SRC=\"foo.gif\" border=\"0\">
>
> How can I prevent PHP from doing this translation and giving me back
> just what I wrote inside the field?
>
>
> bye by{t}e[s].... TuX!