Reputation: 6264
I have one text saved in MySQL Database
<p> Celebrate with these amazing<br /> offers direct from the
Now when I print that text using
echo
I got this output
<p> Celebrate with these amazing<br /> offers direct from the
but U want to display that as
Celebrate with these amazing
offers direct from the
like HTML print.
when i see in db its stored like bellow
<p>
Celebrate with these amazing<br />
offers from
How to do this?
Upvotes: 0
Views: 11554
Reputation: 1566
If you are outputting to the console (it's not clear from your question what you are trying to output to):
If you look at the PHP strip_tags documentation, you should be able to reach something approximating what you want. https://www.php.net/manual/en/function.strip-tags.php
With strip_tags(), you can allow the
tag to remain and then replace it with "\n" afterwards.
Otherwise, if you are outputting to browser, then other posts on this page have the answer - you must be storing the htmlentities() version of the data in the database.
Upvotes: 0
Reputation: 6346
Assuming your database has saved the escaped information like this:
<p>
Celebrate with these amazing<br />
offers from
Then you could just use PHP's html_entity_decode function to output that block of HTML.
Upvotes: 7
Reputation: 896
maybe this could help you http://php.about.com/od/phpwithmysql/qt/php_in_mysql.htm
Upvotes: 0