This is a discussion on Problem to retrieve information from a mysql database within the PHP Language forums, part of the PHP Programming Forums category; Hi! I have a value loaded in a database as following: <p><strong&...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hi!
I have a value loaded in a database as following: <p><strong>test</strong></p> <p><strong>test 2</ strong><em><strong>questions<img alt="" src="http://www.mysite.com/fckeditor/edit...es/smiley/msn/ regular_smile.gif" /></strong></em></p> when I retrieve the information in a web page using $row[pregunta] (the above value is stored in the previuos variable) the value shown is: <p><strong>test</strong></p> <p><strong>test 2</ strong><em><strong>questions<img alt="" src="http://www.mysite.com/ fckeditor/editor/images/smiley/msn/regular_smile.gif" /></strong></ em></p> when actually what I need to show is the formates text using the HTML tags. Anyone can help me to solved why the string is shown with the HTML tags and not formated' Thanks! Zek |
|
|||
|
zek2005 wrote:
> Hi! > > I have a value loaded in a database as following: > > <p><strong>test</strong></p> > <p><strong>test 2</ > strong><em><strong>questions<img alt="" > src="http://www.mysite.com/fckeditor/edit...es/smiley/msn/ > regular_smile.gif" /></strong></em></p> > > when I retrieve the information in a web page using $row[pregunta] > (the above value is stored in the previuos variable) the value shown > is: > > <p><strong>test</strong></p> <p><strong>test 2</ > strong><em><strong>questions<img alt="" src="http://www.mysite.com/ > fckeditor/editor/images/smiley/msn/regular_smile.gif" /></strong></ > em></p> > > when actually what I need to show is the formates text using the HTML > tags. > > Anyone can help me to solved why the string is shown with the HTML > tags and not formated' > > Thanks! > > Zek > This has nothing to do with PHP. It's how HTML works. <p> will always display <p>. If you want a paragraph tag, you use a paragraph tag: <p>. And so on. You can get more help on this in alt.html. But why are you even storing html tags in your database. You should be storing the data in a display-independent format and format the items when you retrieve them. For more help on this end, see your favorite database newsgroup. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ================== |
|
|||
|
zek2005 wrote:
> Hi! > > I have a value loaded in a database as following: > > <p><strong>test</strong></p> > <p><strong>test 2</ > strong><em><strong>questions<img alt="" > src="http://www.mysite.com/fckeditor/edit...es/smiley/msn/ > regular_smile.gif" /></strong></em></p> > > when I retrieve the information in a web page using $row[pregunta] > (the above value is stored in the previuos variable) the value shown > is: > > <p><strong>test</strong></p> <p><strong>test 2</ > strong><em><strong>questions<img alt="" src="http://www.mysite.com/ > fckeditor/editor/images/smiley/msn/regular_smile.gif" /></strong></ > em></p> > > when actually what I need to show is the formates text using the HTML > tags. > > Anyone can help me to solved why the string is shown with the HTML > tags and not formated' > > Thanks! > > Zek You can try using htmlspecialchars(). This is usually used to prevent html entities from displaying as html such as < >. But it may preserve the the original markup when displayed in a browser. If you can give a reason why you are using this particular data, there may be a better way to accomplish what you want to do. Scotty |