HTML values in DB - how to display

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
crazytopu
Forum Contributor
Posts: 259
Joined: Fri Nov 07, 2003 12:43 pm
Location: London, UK
Contact:

HTML values in DB - how to display

Post by crazytopu »

Say you have the following sentence in your database and you display that in your site using php

Code: Select all

<strong> Welcome John </strong> 
You see the sentence "Welcome " in bold.

Now my question is how do you print the above sentence when it's in the following format (in your DB):

Code: Select all

<strong>Welcome</strong>
Which is nothing but just that the <strong> and </strong> tags have been translated to their corresponding html code.

I tried to print it and all it came up on the screen is

Code: Select all

<strong> I know you </strong>
Is there any php function that I can use to display any such html values stroed in the DB that actually makes the sentence bold. I am assuming any such function will translate all such html values stored in the DB to be output on the screen.

I have used a few functions but none seemed to work.
nowaydown1
Forum Contributor
Posts: 169
Joined: Sun Apr 27, 2008 1:22 am

Re: HTML values in DB - how to display

Post by nowaydown1 »

Have you tried html_entity_decode? (http://us.php.net/manual/en/function.ht ... decode.php)
crazytopu
Forum Contributor
Posts: 259
Joined: Fri Nov 07, 2003 12:43 pm
Location: London, UK
Contact:

Re: HTML values in DB - how to display

Post by crazytopu »

Yes I did, doesnot seem to work for me.
crazytopu
Forum Contributor
Posts: 259
Joined: Fri Nov 07, 2003 12:43 pm
Location: London, UK
Contact:

Re: HTML values in DB - how to display

Post by crazytopu »

It just worked now. Not sure why it didnot work before. Thank you so much. :D
Post Reply