Re: translating special characters when storing to a database

From: Date: Sat, 19 Oct 2002 06:42:12 +0000
Subject: Re: translating special characters when storing to a database
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-120593@lists.php.net to get a copy of this message
Hello DonPro, Friday, October 18, 2002, 8:33:42 PM, you wrote: D> Hi, D> I have a variable called '$myvar' containing the text: D> "this & that" D> I store it into a MySQL table using stripslashes($myvar). D> When I later retrieve the field, it looks like: D> "this &amp that" D> How can I keep it in it's original form when storing it? D> Thanks, D> Don You are sure obtain "this &amp that" and not "this & that"? There is no function to reconvert HTML chars, but you can find in PHP help a function: function unhtmlentities ($string) { $trans_tbl = get_html_translation_table (HTML_ENTITIES); $trans_tbl = array_flip ($trans_tbl); return strtr ($string, $trans_tbl); } -- Best regards, Zoltan mailto:zolikonyves@home.ro

« previous php.general (#120593) next »