You are here: Re: Special Characters into database « PHP Programming Language « IT news, forums, messages
Re: Special Characters into database

Posted by Erwin Moller on 09/28/04 12:01

João Morais wrote:
> Hi there guys,
>
> My doubt is, what's the best way of storing text into a mysql
> database, if the text has special characters.. imagine iso-8859-1.
>
> Should I convert the text using htmlentities and then put it into
> database, and later when I will retrieve it I should use the reverse
> process.
>
> What's the best way of doing this?
>
> Thanks in advance.

Hi,

I think it is easier to store the text raw in the db, and when
displaying it in a browser, use htmlentities.
(Of course, make sure you escape the text before inserting to avoid SQL
injection, eg via mysql_real_escape.)

In my opinion that is the cleanest way to store data, and you can also
use the data for other purposes, eg searching without having to worry
about changed characters because of the htmlentities.

Regards,
Erwin Moller

 

Navigation:

[Reply to this 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

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