Reputation: 177
How can i retrieve the data from the database in which the data is in the form of
<p>&nbsp;</p>
<p><span style="\">Classic Developers, a destination that offers every one luxurious and fulfilling yet affordable lifestyle. It is one of the emerging real estate developers in the country having diverse range of activities in varied business domain. We are a certified company having large scale projects in progress.</span></p>
<p><span style="\"><br /></span></p>
<p><span style="\">Classic Developers with its dynamic professional work force and uncompromising attitude in terms of construction methodologies and quality control procedures, we offer you Efficient, Elegant and Economical place, which will be called your home, your happiness. We are here not only for a residential place but to fulfill your dream of having a home with modern day comfort and soothing ambience. We not only offer modern structures with latest amenities but ensure all the valued customers with Earthquake resistant and VASTU compliant construction.</span></p>
<p>&nbsp;</p>
and i need the value without the html tags and other style. Only i want is the text in it. HOw can i retrieve it with php.
Thanks in advance.
Upvotes: 0
Views: 3792
Reputation: 2872
http://php.net/manual/en/function.strip-tags.php
Once you have it from the database, run this function on it before you echo it out:
$content = strip_tags($content);
EDIT
The question was edited to show the special chars instead of raw HTML. If it is in that style, try it this way around:
$content = strip_tags(htmlspecialchars_decode($content));
Upvotes: 7
Reputation: 6155
If you don't want simple solution that @Ben Griffiths suggested and you still need pure DB processing, then look into regular expressions - see MySQL regex replace?
Upvotes: 0
Reputation: 6704
You can use strip_tags()
method to clean up your input after you get the column from your database.
Upvotes: 1