Rendering HTML from a MYSQL table

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
bentobenji
Forum Newbie
Posts: 1
Joined: Tue Apr 28, 2009 6:40 am

Rendering HTML from a MYSQL table

Post by bentobenji »

Ok, I searched google and these boards for an answer to no avail, so I'm taking a stab at this. I hope it's not something painfully obvious in the end.

Basically, I have medium sized data with html tags in it. I want to read the data into a php variable with the html tags in tact to then display it correctly in the browser. I can get my data and print/echo it, but it converts the html tags into ascii characters rather than the appropriate html rendering.

I've done this before with xml by putting <![CDATA[ ]] around the data node, and it works beautifully. However, this doesn't work with mysql. I've tried different text, varchar, blob data types to the same effect. It seems that the browser would see the tags and just read them as html, but I guess I'm missing something.

I really prefer to keep the html tags for certain purposes. Can anyone help me??
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: Rendering HTML from a MYSQL table

Post by susrisha »

probably this is what you are looking for
http://in2.php.net/htmlentities
Post Reply