Reply to Re: pear DB converting ' to &#039 - how to convert back?

Your name:

Reply:


Posted by Koncept on 01/09/07 16:06

In article <8Xvoh.20798$U12.20666@bignews1.bellsouth.net>, Paul
<lof@invalid.com> wrote:

> I have tested my logic flow and determined that the conversion from what is
> given to the
> $db->prepare() statement and what is stored in the database iteslf goes
> from:
>
> "I'm helpful"
> to
> "I&#039;m helpful"
>
> is converted by pear's DB. I am using $db->prepare() statement. When I do
> a print_r() of $db after the prepare(), it does display:
> ...., field2 = 'I'm helpful', field3=....
>
> but what ends up in the database is:
> "I&#039;m helpful"
>
> I'm using PHP 4.3 and have tried html_entity_decode() and others
> unsuccessfully.
>
> Any ideas?
>
>
>

Maybe something like this?

<?php
$encoded = "&#104;&#101;&#108;&#108;&#111;
&#119;&#111;&#114;&#108;&#100;";
echo preg_replace('/&#(\d+);/e','chr(\1)', $encoded);
?>

--
Koncept <<
"The snake that cannot shed its skin perishes. So do the spirits who are
prevented from changing their opinions; they cease to be a spirit." -Nietzsche

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация